got a program cant use cin directly for numerics have to use like cin.getline but for some reason it does not work with the pointers i have set up please help
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
using std::ios;
#include <iomanip>
using std::setw;
#include <cstring>
#include <cstdlib>
class course
{
public:
char className[11]; // designation
char term[7]; // Term
int units; // Units
char grade; // Grade
course* next; // Next node
};
// Prototype(s)
void printCourse(course*);
int courseCmp(const course*, const course*);
int myStricmp(constchar*, constchar*);
int myStrnicmp(constchar*, constchar*, int count);
int main()
{
char classEntry;
// empty list
course* head = 0;
course* cEntry = 0;
while(1)
{
// show list blank or already entered
// Prompt user if they would like to enter another class
printCourse(head);
cout << endl;
cout << "Would you like to enter another class? [Y/N]: ";
cin >> classEntry;
cin.ignore(1000, 10);
cout << endl;
// if user enters no print class history and break
if (classEntry == 'N' || classEntry == 'n')
{
printCourse(head);
break;
}
// Otherwise enter all data
if (classEntry == 'Y' || classEntry == 'y')
{
cEntry = new course;
cout << "COURSE: Enter your course name [Ex: comsc-110, 10 Characters Max]: ";
cin.getline(cEntry->className, 11);
cout << "TERM: Enter the term [Ex: fa2011, 6 Characters Max]: ";
cin.getline(cEntry->term, 7);
cout << "UNITS: Enter # of units [1-5]: ";
cin >> cEntry->units;
cin.ignore(1000, 10);
cin.ignore(1000, 10);
Do not do that. Use cin.ignore(1000, '\n');
Windows line feed is actually two symbols: 10 and 13.
Aside from that code is working fine: everything working and cEntry is filled as it should.