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..
operating system Vista 64bit
Visual Studio 2005
case '2':
{
string course_name;
string code;
string title;
system("CLS");
cout << " Add Subject in course\n\n ";
do
{
cout << "Please Enter Course Name in Which u want to add Subjects ";
cin >> course_name;
ifstream infile;
string temp = course_name + ".txt";
infile.open(temp.c_str());
if(infile.fail())
{
cout << "No " << course_name << " is available " << endl;
break;
}
_getch();
cout << "Please Enter Subject Name ";
getline(cin,title);
cout << " Title is " << title << endl;
cout << "Please Enter Subject Code";
cin >> code;
course.addSubject(course_name,code,title);
cout << "You want to add more subjects ? Y/N ";
}
while(_getch()=='y');
cout << "Press any key to go back " << endl;
_getch();
welcome_screen();
newSelection = menu_system();//these lines are the same as
processChoice1(newSelection);//in main, where we began
}
break;