#Include

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

#include<iostream>

using namespace std;

int main()
{
system("color 70");
int n, Grace, failed, passed;
cout << "Enter class of student : ";
cin >> n;
switch (n)
{
case 1:
cout << "Student is in first class\n";
cout << "Enter the Subjects failed out of 5 subjects\n";
cin >> failed;
if (failed > 3)
cout << "Student does not get grace marks\n";
else if (failed <= 3)
{
cout << "Student gets 5 grace marks per subject\n";
passed = 5 - failed;
cout << "\nPassed Subjects = " << passed;
Grace = 5 * passed;
cout << "\nStudent gets grace marks on passing " <<
passed << " subjects are = " << Grace;
}
else
cout << "enter the number b/w 1 and 5 \n";
break;
case 2:
cout << "\nStudent is in Second class\n";
cout << "Enter the Subjects failed out of 5 subjects\n";
cin >> failed;
if (failed > 2)
cout << "Student does not get grace marks\n";
else if (failed <= 2)
{
cout << "Student gets 4 grace marks per subject\n";
passed = 5 - failed;
cout << "\nPassed Subjects = " << passed;
Grace = 4 * passed;
cout << "\nStudent gets grace marks on passing " <<
passed << " subjects are = "<<Grace;
}
else
cout << "enter the number b/w 1 and 5 \n";
break;
case 3:
cout << "\nStudent is in third class\n";
cout << "Enter the Subjects failed out of 5 subjects\n";
cin >> failed;
if (failed > 1)
cout << "Student does not get grace marks\n";
else if (failed == 1)
{
cout << "Student gets 5 grace marks per subject\n";
passed = 5 - 1;
cout << "\nPassed Subjects = " << passed;
Grace = 5 * passed;
cout << "\nStudent gets grace marks on passing " <<
passed << " subjects are = "<<Grace;
}
else
cout << "enter the number b/w 1 and 5 \n";
break;
default:
cout << "Please enter the class from 1 to 3 \n";
}

getchar();
return 0;
}

#include<iostream>
using namespace std;

int main()
{
system("color 70");
for (int i = 1; i <= 5; i++)
{
switch (i)
{
case 1:
cout << "\nThe first day of Christmas my true love
sent to me,a partridge, and a pear-tree ";
break;
case 2:
cout << "\nThe second day of Christmas my true love
sent to me ";
break;
case 3:
cout << "\nThe third day of Christmas my true love
sent to me ";
break;
case 4:
cout << "\nThe fourth day of Christmas my true love
sent to me ";
break;
case 5:
cout << "\nThe fifth day of Christmas my true love
sent to me ";
break;
}
switch (i)
{
case 5:
cout << ",five hares running";
case 4:
cout << ",four ducks quacking";
case 3:
cout << ",three fat hens";
case 2:
cout << ",two turtle-doves";
case 1:
cout << ",a partridge, and a pear-tree";
}
}
getchar();
return 0;
}

#include<iostream>
using namespace std;

int main()
{
system("color 70");
int x, units_digit, tens_digit;
cout << "Enter a two-digit number:";
cin >> x;
units_digit = x % 10;
tens_digit = x / 10;
if (x >= 0 && x < 100)
{
cout << "\nNumber in words : ";
if ((x >= 0) && (x <= 19))
{
switch (x)
{
case 0:
cout << " zero";
break;
case 1:
cout << " one";
break;
case 2:
cout << " two";
break;
case 3:
cout << " three";
break;
case 4:
cout << " four";
break;
case 5:
cout << " five";
break;
case 6:
cout << " six";
break;
case 7:
cout << " seven";
break;
case 8:
cout << " eight";
break;
case 9:
cout << " nine";
break;
case 10:
cout << " Ten";
break;
case 11:
cout << " Eleven";
break;
case 12:
cout << " Twelve";
break;
case 13:
cout << " Thirteen";
break;
case 14:
cout << " Fourteen";
break;
case 15:
cout << " Fifteen";
break;
case 16:
cout << " Sixteen";
break;
case 17:
cout << " Seventeen";
break;
case 18:
cout << " Eighteen";
break;
case 19:
cout << " Nineteen";
break;

}
}
else if ((x >= 20) && (x < 100))
{
switch (tens_digit)
{
case 2:
cout << " twenty- ";
break;
case 3:
cout << " thirty- ";
break;
case 4:
cout << " forty- ";
break;
case 5:
cout << " fifty- ";
break;
case 6:
cout << " sixty- ";
break;
case 7:
cout << " seventy- ";
break;
case 8:
cout << " eighty- ";
break;
case 9:
cout << " ninety- ";
break;
}
switch (units_digit)
{
case 1:
cout << "one";
break;
case 2:
cout << "two";
break;
case 3:
cout << "three";
break;
case 4:
cout << "four";
break;
case 5:
cout << "five";
break;
case 6:
cout << "six";
break;
case 7:
cout << "seven";
break;
case 8:
cout << "eight";
break;
case 9:
cout << "nine";
break;

}
}
else
{
cout << "Number is not in range 0-99\n";
}

getchar();
return 0;
}
#include<iostream>
using namespace std;

int main()
{
system("color 70");

int pass, n, Current_Amount = 10000, withdraw, old_password,


new_password,amount;
cout << "\t$$$$$$ Welcome to ATM MACHINE $$$$$$\n\n";
cout << "Enter password : ";
cin >> pass;
if (pass == 9011)
cout << "Password Accepted\n";
else
{
cout << "Wrong password try again \n";
cin >> pass;
if (pass == 9011)
{
cout << "Password Accepted\n";
}
else
{
cout << "sorry your password is again wrong , next try
is after 30min\n";

}
}
cout << "Press 1 to Withdraw cash\n";
cout << "Press 2 to check current balance\n";
cout << "Press 3 to update password\n";
cout << "Press 4 to transfer funds\n";
cout << "Select an option : ";
cin >> n;
switch (n)
{
case 1:
cout << "Enter cash to withdraw ";
cin >> withdraw;
if (withdraw < Current_Amount)
{
cout << "Withdraw Successful\n";
}
else if (withdraw > Current_Amount)
{
cout << "You have insufficient balance\n";
}
break;
case 2:
cout << "The current balance is " << Current_Amount << "
PKR\n";
break;
case 3:
cout << "Welcome to password reset\n";
cout << "Enter old password : ";
cin >> old_password;
if (old_password == pass)
{
cout << "\nEnter new password\n";
cin >> new_password;

cout << "\nPassword is changed successfully\n";


}
else
cout << "Password incorrect\n";
break;
case 4:
cout << "Enter funds to transfer\n";
cin >> amount;
cout << "\nTransaction successful\n";
if (amount > Current_Amount)
{
cout << "transforming amount is greater than current
amount \n";
cout << "try again \n\n";
cin >> amount;
}
if (amount < Current_Amount)
{
cout << amount << "/RS\t transfer successfully ";
}
break;
default:
cout << "Invalid option \n";
}

getchar();
return 0;
}

You might also like