-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRandomNumberWithSwitchStatement.cpp
More file actions
30 lines (26 loc) · 1.32 KB
/
RandomNumberWithSwitchStatement.cpp
File metadata and controls
30 lines (26 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main(){
srand(time(0));
int daysUntilExpilation = rand()%12;
cout << "The random number is: " << daysUntilExpilation<< endl;
switch (daysUntilExpilation){
case 10: cout << "Your subscription will expire soon. Renew now!" << endl; break;
case 9: cout << "Your subscription will expire soon. Renew now!" << endl; break;
case 8: cout << "Your subscription will expire soon. Renew now!" << endl; break;
case 7: cout << "Your subscription will expire soon. Renew now!" << endl; break;
case 6: cout << "Your subscription will expire soon. Renew now!" << endl; break;
case 5: cout << "Your subscription expires in " << daysUntilExpilation << endl;
cout << "Renew now and save 10%"<< endl; break;
case 4: cout << "Your subscription expires within<< 4 << days!"<< endl;
case 3: cout << "Your subscription expires within << 3 <<days!"<< endl;
case 2: cout << "Your subscription expires within <<daysUntilExpiration<< days!"<< endl;
case 1: cout << "Your subscription expires within a day!"<< endl;
cout << "Renew now and save 20%"<<endl; break;
case 0: cout << "Your subscription has expired"<< endl; break;
default : cout <<"you have an active subscription."<< endl;break;
}
return 0;
}