Quote:
|
does anyone know how to read in a steam of charactes, on after another, one at a time, and build a sentence out of them
|
Is this what you mean?
Code:
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
int main(int argc, char *argv[])
{
string letters;
string input;
unsigned count(0);
for(;;)
{
//Use getline so spaces and tabs are counted in.
getline(cin, input, '\n');
if(input[0] == '@') //@ terminates the input sequence.
break;
else
{
//Add only ONE single letter. Ignore the rest.
letters+=input[0];
}
}
cout<<letters<<endl;
system("PAUSE");
return 0;
}
If so, then try the rest of your assignment for yourself first. It's a nice excercise.