0

Help me fix this code i cant run it

#include<iostream> using namespace std; int main() {switch (z) { case 1: z = (z + 10) * 25; cout << x <<; break; case 2: z = z - 10; cout << x + 30 <<; break; case 3: z = z - 10; cout << z <<; break; default: cout << z * z <<; break; } return 0; }

19th Jan 2021, 6:11 AM
Edson Jay A. Malazar
Edson Jay A. Malazar - avatar
3 Réponses
+ 2
cout << something; OR cout << something << endl; And you have to declare your variables first before using it to your program. int x; int z;
19th Jan 2021, 6:15 AM
noteve
noteve - avatar
+ 2
And also the variable "x". Here, try to run this code, this is working because the x and z are declared beforehand and I added endl to each "cout". Excuse my indentions for now. If you want explanations, feel free to ask. Thanks! https://code.sololearn.com/cA5A24A4a2a1
19th Jan 2021, 6:31 AM
noteve
noteve - avatar
+ 1
I cant run it even if i declare variable z
19th Jan 2021, 6:19 AM
Edson Jay A. Malazar
Edson Jay A. Malazar - avatar