Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 26 additions & 30 deletions exercises/ex1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,34 @@ int main()
cout << "Enter week number(1-7): " << endl;
cin >> week;

if (week == 1)
{
cout << "Monday" << endl;
}
else if (week == 2)
{
cout << "Tuesday" << endl;
}
else if (week == 3)
{
cout << "Wednesday" << endl;
}
else if (week == 4)
{
cout << "Thursday" << endl;
}
else if (week == 5)
{
cout << "Friday" << endl;
}
else if (week == 6)
{
cout << "Saturday" << endl;
}
else if (week == 7)
{
cout << "Sunday" << endl;
}
else
{
switch (week)
{
case 1:
cout << "Monday" << endl; /* code */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non ca pisco il significato del commento "code"

break;
case 2:
cout << "Tuesday" << endl; /* code */
break;
case 3:
cout << "Wednesday" << endl; /* code */
break;
case 4:
cout << "Thursday" << endl; /* code */
break;
case 5:
cout << "Friday" << endl; /* code */
break;
case 6:
cout << "Saturday" << endl; /* code */
break;
case 7:
cout << "Sunday" << endl; /* code */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c'è un po' troppa ridondanza, si potrebbe migliorare il codice evitando di ripetere sempre "endl" o cout

break;
default:
cout << "Invalid input! Please enter week number between 1-7." << endl;
break;
}


return 0;
}