why i enter "hello every one" but it shows "hello"?what should i write alternate of cin?? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
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; }

13th Nov 2017, 2:44 AM
Frankestine Stine
Frankestine Stine - avatar
1 ответ
- 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
13th Nov 2017, 3:39 AM
Rambabu Kuntal
Rambabu Kuntal - avatar