Professional Documents
Culture Documents
Psycology
Psycology
Psycology
ABBOTTABAD
Submitted by: US M AN
Roll no: 207018
Department: Computer Science
Semester: 6th
Submitted to: SIR YASHIR
#include <iostream>
using namespace std;
int main ()
{
int choice;
{
cout<<"1) Display Alhamdulillah."<<endl;
cout<<"2) Display your Name and Registration No. on
Screen."<<endl;
cout<<"3) Take two number and arithmetic operator
from user and perform the arithmetic operation on
numbers."<<endl;
cout<<"4) Take three ages from user and display the
younger and older."<<endl;
cout<<"5) Take number from user and check whether it
is even or odd."<<endl;
cout<<"6) Give 15% discount if total bill exceeds from
1500."<<endl;
cout<<"7) Give 10% increment to employee if his/ her
year of service is greater than 5."<<endl;
cout<<"8) Grading System."<<endl;
cout<<"9) Input number of rows, columns, and symbol
from user and print the symbol."<<endl;
cout<<"10) Alphabet is vowel or consonant. "<<endl;
cout<<"11) Table with limit."<<endl;
cout<<"12) Fibonacci Series."<<endl;
cout<<"13) Exit."<<endl;
switch(choice)
{
case 1:
{
cout<<"ALHAMDULILLAH"<<endl;
break;
}
case 2:
{
string name, reg;
switch(oper)
{
case '+':
ans=x+y;
break;
case '-':
ans=x-y;
break;
case '*':
ans=x*y;
break;
case '/':
if(x||y==0)
{
cout<<"Cannot divide by 0";
}
else
{
ans=x/y;
}
break;
default:
cout<<"Invalid Operator"<<endl;
return 0;
}
cout<<"Answer is : "<<x<<" "<<oper<<"
"<<y<<"="<<ans<<endl;
break;
}
case 4:
{
int age1,age2,age3;
cout<<"Enter Age: \n";
cin>>age1>>age2>>age3;
int young_age,old_age;
//for YOUNGEST
if (age1 <= age2 && age1 <= age3)
{
young_age = age1;
}
else if (age2 <= age1 && age2 <= age3)
{
young_age = age2;
}
else
{
young_age = age3;
}
//for OlDEST
if (age1 >= age2 && age1 >= age3)
{
old_age = age1;
}
else if (age2 >= age1 && age2 >= age3)
{
old_age = age2;
}
else
{
old_age = age3;
}
cout << "The youngest age is: " << young_age <<
endl;
cout << "The oldest age is: " << old_age << endl;
break;
}
case 5:
{
int x;
cout<<"Enter a Number: ";
cin>>x;
if(x%2==0)
{
cout<<"Number is Even";
}
else
{
cout<<"Number is Odd";
}
break;
}
case 6:
{
int x,y,z;
cout<<"Bill Amount: ";
cin>>x;
if(x>1500)
{
y=0.15*x;
cout<<"Discounted Bill: "<<y<<endl;
z=x-y;
}
else
{
z=x;
}
cout<<"Total Bill: "<<z<<endl;
break;
}
case 7:
{
float x,y,z;
cout<<"Salary: ";
cin>>x;
cout<<"Year of Service: ";
cin>>y;
if(y>5)
{
z=0.10*x;
z=x+z;
}
else
{
z=x;
}
cout<<"Incremented Salary: "<<z<<endl;
break;
}
case 8:
{
int a,b,c,d,avrg;
char grade;
cout<<"Maths: ";
cin>>a;
cout<<"Physics: ";
cin>>b;
cout<<"Chemistry: ";
cin>>c;
cout<<"Bio: ";
cin>>d;
avrg=(a+b+c+d)/4;
if(avrg>=80)
{
cout<<"Grade A";
}
else if(avrg>=70)
{
cout<<"Grade B";
}
else if(avrg>=60)
{
cout<<"Grade C";
}
else
{
cout<<"Fail";
}
break;
}
case 9:
{
int
rows,cols;
char symbol;
break;
}
case 12:
{
int num, first = 0, second = 1, next;
cout<< "Enter the number of terms: ";
cin>> num;
break;
}
case 13:
{
cout<<"EXIT";
break;
}
default:
{
OUTPUT