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 22:29

Compiles fine in the free one at http://cc.codegear.com/Free.aspx?id=24778 (after adding using namespace std;)

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