0

Please some one help me my Teacher has give me a assignment to make a code that will print the days with their number

Example:if(a==1){cout<<"Monday";} But if I want to print Tuesday it will be printed twice for Wednesday day it should be printed thrice and so on but using loops is the condition that you have to use only loops for repetition https://code.sololearn.com/cr1Tv1NUe6ri/?ref=app

25th Feb 2020, 2:35 PM
Hussain Ali
Hussain Ali - avatar
5 Respostas
+ 5
// please attach your source code so community can help you ;)
25th Feb 2020, 3:36 PM
Sudarshan Rai
Sudarshan Rai - avatar
0
Hi! your code example would be very useful so that we can understand where you stumbled
25th Feb 2020, 3:48 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
Use a dictionary with numbers as the keys and the days as the values. When you call the dictionary with the number key it will return the day value. You don't need to loop and you don't need to make a nested conditional statement to do this. Your current problem is probably related to an error in the nested conditional logic. Drop that approach and use a dictionary instead.
25th Feb 2020, 4:06 PM
LeVert
LeVert - avatar
0
Thanks 😊
25th Feb 2020, 4:41 PM
Hussain Ali
Hussain Ali - avatar