getline(cin,str) is not working in code

i want to add a line at run time in title, but i m unable to do so..
in main() getline(-,-) is working fine but not in the below code, it simply skip it when i put values for Course Name and press enter it go to the next line which is code.. can any one tell me any solution..

Oh, and heres just a freindly tip. When you declare variables, its preferable to initialize them immediatly, or they will contain 'garbage' that might or might not cause problems. You can initialize them to their null state, like for strings, (" "), for integers (0) and so on :)

Oh, and heres just a freindly tip. When you declare variables, its preferable to initialize them immediatly, or they will contain 'garbage' that might or might not cause problems. You can initialize them to their null state, like for strings, (" "), for integers (0) and so on :)

Not agreed about the strings...
Consider the following line of code:string s;, will it contain garbage?
No.

It can. If you do not initialize it, it can contain the last value a variable of that type had. Uninitialized variables can go do any memory slot, regardless of whether the slots are vacant or not ;)

Wrong!

If you're talking about C-strings, in other words: character arrays, then it can contain garbage if you don't initialize it.
When talking about C++ strings you don't have to initialize it, your string doesn't contain garbage when you don't initialize it.

Consider the following examples:

// Using a C-string
char cstring[50];
cout << cstring << endl; // garbage in most of the times

If you're talking about C-strings, in other words: character arrays, then it can contain garbage if you don't initialize it.
When talking about C++ strings you don't have to initialize it, your string doesn't contain garbage when you don't initialize it.

Consider the following examples:

// Using a C-string
char cstring[50];
cout << cstring << endl; // garbage in most of the times

Oh, all right. Makes sense. I just tested it out right now, and got proved wrong myself. Thanks for correcting me, but i think i'll just keep initializing Strings just the same. Thats my way, and thats how ive been coding ever since i started.
Still, thanks. :)