add Chapter 4 Question 2

This commit is contained in:
kuoi 2022-08-25 19:01:36 +01:00
parent d986e73f12
commit e59770121a
1 changed files with 19 additions and 0 deletions

19
ch04/02.cpp Normal file
View File

@ -0,0 +1,19 @@
# include <iostream>
using namespace std;
int main(){
/** const int ArSize = 20; **/
/** char name[ArSize]; **/
/** char dessert[ArSize]; **/
string name, dessert;
cout << "Enter your name: " ;
// cin.getline(name,ArSize);
getline(cin,name);
cout << "Enter your dessert: " ;
// cin.getline(dessert,ArSize);
getline(cin,dessert);
cout << "I have some delicious " << dessert << " for you, " << name << "." << endl;
return 0;
}