0

Correct the code please

int main() { int no_of_namaz; string namaz; cout << "do you offer prayers five times daily"; cout << "result 'Y' is for praying regularly 'y' is for kabhi kabhi"; cout << "and result 'N' is for never and 'n' is for very rare"; cin >> no_of_namaz; while (no_of_namaz < 1 || no_of_namaz > 5) { cout << "N\n"; while (no_of_namaz < 2 || no_of_namaz > 3) { cout << "n\n"; while (no_of_namaz < 5 || no_of_namaz > 4) { cout << "y\n"; while (no_of_namaz = 5) { cout << "Y" << endl; } }

23rd Nov 2019, 3:58 AM
Muhammad Bilal
1 ответ
+ 1
You shouldn't mention your email here, I changed your code: #include <iostream> using namespace std; int main() { int no_of_namaz; string namaz; cout << "do you offer prayers five times daily\n"; cout << "result 'Y' is for praying regularly 'y' is for kabhi kabhi\n"; cout << "and result 'N' is for never and 'n' is for very rare\n"; cin >> no_of_namaz; if (no_of_namaz <= 1) { namaz = "N";} if (no_of_namaz == 2 || no_of_namaz == 3) { namaz = "n";} if (no_of_namaz == 4) { namaz = "y";} if (no_of_namaz >= 5) { namaz = "Y"; } cout << namaz << endl; }
23rd Nov 2019, 12:49 PM
Paul
Paul - avatar