+ 1
I am getting some sort of problem. Please help
#include<iostream> int main() { int day; cout<<"Enter a number between 1 to 7\n"; cin>>day; switch(day) { case 1: cout<<"Monday\n"; break; case 2: cout<<"Tuesday\n"; break; case3: cout<<"Wednesdsay\n"; break; case 4: cout<<"Thursday\n"; break; case 5: cout<<"Friday\n"; break; case 6: cout"Saturday\n"; break; case 7: cout<<"Sunday\n"; break; } return 0; }
7 Respuestas
0
In Case 6 u miss << and in third case give some space between case and 3.
+ 2
there should be space in “case3:” it should be like “case 3:”
+ 2
<< is missing in cout in case 6.
+ 1
1st : case3, add space between case and 3 --> case 3 : cout << "Wedensday\n";
2nd : in case 6: after cout add <<, --> case 6 : cout << "Saturday\n";
3rd : use std befor evry cout in the code --> std::cout , or add using namespace std;
#include <iostream>
using namespace std;
+ 1
Note: its better to add a fefault case in the end of all cases, when user input number out of "1 to 7" it will help.
Eg: default : cout << "number must be from 1 to 7\n";
+ 1
First
You should include the "using namespace std;". You left that out.
Then on case 6 it should be "cout<<Saturday "....you left out"<<".
+ 1
Thanks A Lot Guys