ok, so I have the following code.
#include <iostream>
using namespace std;
int main()
{
char name[80];
cout << "\n\nEnter your name: ";
cin >> name;
cout << name;
return 0;
}
but here's the problem. whenever I enter a space in the name, everything after the space doesn't appear in the shell. so is looks like this.
Enter your name: John Appleseed
John
[process complete]
returned with a value of 0
so after think about this for about the past hour I came to the conclusion that the sequence ends when is sees a null character. thinking to myself that a space might be viewed as a null character... I wrote the following code to try and fix it.
#include <iostream>
using namespace std;
int main()
{
int a;
char name[80];
cout << "\n\nEnter your name: ";
cin >> name;
for (a=0; a<80; a++)
{
if ((name[a] == '\0') && (name[a+1] == '\0'))
break;
else if ((name[a] == '\0') && (name[a+1] != '\0'))
name[a] = ' ';
else
continue;
}
cout << name;
return 0;
}
still with no luck...
any suggestions?