Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

New to C++ (getline) in borland

Name: Newbie Programmer 2008-01-12 21:51

I'm new to C++. I'm trying to use "getline" in my program to accept character and whitespace inbetween but I get some error in Borland.

/* This program defines class GradeBook with a
member function that takes a parameter; */

#include <iostream>
#include <string>
#include <conio.h>

class GradeBook
{
public:

    void displaymessage (string coursename)
    {
    cout << "\nWelcome to the Grade Book System\n\nThe name of your course is " << coursename <<endl;
    }
};


int main ()
{
   string NameOfCourse;
   GradeBook mygradebook;

   cout << "Please Enter the name of your course: " <<endl;
   getline (cin, NameOfCourse);  /* "Call to undefined function 'getline' error" */

    // cin >> NameOfCourse; //White space ends insertion operator

   mygradebook.displaymessage (NameOfCourse);

   getch();
   return 0;
}

Name: Anonymous 2008-01-12 23:07

>>15
Yeah, it's from early 1997, and C++ was standardized in 1998, so that's probably why it's not quite right in places, e.g. getline.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List