+ 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; }

6th Mar 2020, 5:21 AM
Rahil Kamdar
Rahil Kamdar - avatar
7 Antworten
0
In Case 6 u miss << and in third case give some space between case and 3.
6th Mar 2020, 2:54 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 2
there should be space in “case3:” it should be like “case 3:”
6th Mar 2020, 5:24 AM
Jagjot Mann
Jagjot Mann  - avatar
+ 2
<< is missing in cout in case 6.
6th Mar 2020, 11:10 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 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;
6th Mar 2020, 12:22 PM
Rafik Abdelhak Nadir
Rafik Abdelhak Nadir - avatar
+ 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";
6th Mar 2020, 12:25 PM
Rafik Abdelhak Nadir
Rafik Abdelhak Nadir - avatar
+ 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"<<".
6th Mar 2020, 9:01 PM
Janice Angella
+ 1
Thanks A Lot Guys
8th Mar 2020, 6:13 AM
Rahil Kamdar
Rahil Kamdar - avatar