multiple word error

From: Giovanni Noppe (noppe.g_at_wanadoo.be)
Date: 11/19/03


Date: Wed, 19 Nov 2003 17:36:31 +0100

Hello,

I'm writing a program, but I've got a question. I wrote a simple program
that explains my problem. First you must give in an integer and next you
must give a string containing multiple words. If I put an integer in my
variable that is okay, but I have to hit enter twice instead of once for my
string. Is there someone who knows how I can solve this problem ?

Thanks,

Giovanni Noppe,
noppe.g@wanadoo.be

////////////////////////////////////////////////////
#include <string>
#include <iostream>
using namespace std;

void main()
{
 int getal;
 string zin;
 cout<<"Integer : ";
 cin>>getal;
 cin.ignore(255,'\n');
 cin.clear();
 cout<<"String : ";
 getline(cin,zin);
 cout<<"\n\n\n";
 cout<<getal<<endl;
 cout<<zin;
}
////////////////////////////////////////////////////



Relevant Pages

  • Re: Writing idiomatically for the cello and other string instruments
    ... writing for string instrument, specifically the cello. ... Also, get with a cello player and talk, ... Most of us sadly dont have a string player easily available- ...
    (rec.music.theory)
  • Re: Rewrite last line in text file
    ... Now parse the buffer backwards, ... TFileStream to that point ... start writing your replacement string. ...
    (borland.public.delphi.language.objectpascal)
  • How good is PERL at searching ASCII files?
    ... some text manipulation that needs doing and I've heard many times that ... or should I just spend 3 or 4 hours writing ... segregate the three param calls from the two param calls. ... The key elements being the string CONVERT, ...
    (perl.beginners)
  • How good is PERL at searching ASCII files?
    ... some text manipulation that needs doing and I've heard many times that ... or should I just spend 3 or 4 hours writing ... segregate the three param calls from the two param calls. ... The key elements being the string CONVERT, ...
    (comp.lang.perl.misc)
  • Re: How good is PERL at searching ASCII files?
    ... Can PERL do th ... or should I just spend 3 or 4 hours writing ... segregate the three param calls from the two param calls. ... The key elements being the string CONVERT, ...
    (comp.lang.perl.misc)