0
why i enter "hello every one" but it shows "hello"?what should i write alternate of cin??
#include <iostream> using namespace std; int main() { char str[100]; cout << "Enter a string: "; cin >> str; cout << "You entered: " << str << endl; cout << "\nEnter another string: "; cin >> str; cout << "You entered: "<<str<<endl; return 0; }
2 Answers
- 3
#include <iostream>
using namespace std;
int main()
{
string str[100];
cout << "Enter a string: ";
cin >> str[0];
cout << "You entered: " << str[0] << endl;
cout << "\nEnter another string: ";
cin >> str[1];
cout << "You entered: "<<str[1]<<endl;
return 0;
}
you have to enter
Tyu
yui