Why does my code take integer 8 as default when no number in entered through cin. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why does my code take integer 8 as default when no number in entered through cin.

This is happening in code playground. So pls check the code there and here is code :- #include <iostream> using namespace std; int main(){ int x, y, z; /* For single input */ cin >> x; cout << "Enter a number: " << x << endl; /* For multiple inputs*/ cout << "Enter 2 numbers: "; cin >> y >> z; cout << "Sum = " << (x+y+z); return 0; }

22nd Jun 2019, 6:13 AM
BoiCoded
0 Answers