#include <iostream> using namespace std; char(hack) { char hack; cout<<"which hacking do you wants to learn"<<hack<<endl; cin>>h | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

#include <iostream> using namespace std; char(hack) { char hack; cout<<"which hacking do you wants to learn"<<hack<<endl; cin>>h

please tell what is wrong in this code

23rd Jul 2018, 4:02 PM
Adarsh Thakur
Adarsh Thakur - avatar
2 Answers
+ 7
#include <iostream> using namespace std; int main(){ char hack; cin>>hack; cout<<"which hacking do you wants to learn: "<<hack<<endl; } Something like this, tho char will allow only 1 char as an input and not a string
23rd Jul 2018, 4:20 PM
Frost
Frost - avatar
0
#include<iostream> #include<string> using namespace std; int main() { string hack; cout << "which hack would you like learn" << endl; getline(cin, hack); return 0; }
24th Jul 2018, 5:02 PM
Tevin Charles
Tevin Charles - avatar