hello guys
i am having a difficulty with this simple program. I am only a beginner so it is kinda hard for me to program this simple program:
program is supposed to ask user name, print it and aks for 3 numbers and add them up before printing the result.
the this is that when asked for name, if i input my first name and my family name, it does not work and bypasses the step of asking numbers:
the code is:
#include <iostream>
int main ()
{
char type [50];
int a, b, c,d;
cout<<"Hello! What is your name?\n";
cout<<"Enter your name.\n"
cin>>type; // this is where the problem is..if there is a space between the 2 names, it does not work
cout<< "hello"<<type<<"please enter 3 numbers.";
cout<< "number 1\n";
cin>>a;
cout<< "number 2\n";
cin>>b;
cout<< "number 3\n";
cin>>c;
d=a+b+c;
cout<< "The answer is"<<d;
return 0;
}