Programming With C++: (TASK 3)
Programming With C++: (TASK 3)
Programming With C++: (TASK 3)
PROGRAMMING
with C++
[TASK 3]
Student Name: Ahmed Fouad Mohamed
ID: 20190118
Supervisor
Dr. Nour S. Bakr
Eng . Manar Fathy
1
#include <iostream>
using namespace std;
int main()
{
int ID;
cout << "Name:Ahmed Fouad Mohamed Waghe " << endl;
cout << "________________________________" << endl;
cout << "Enter ID : "; cin >> ID;
cout << "________________________________" << endl;
cout << " print actual grad in certain subject also print your total grad depend
on gpa " << endl;
cout <<
"_______________________________________________________________________________" <<
endl;
int score;
cout << "enter your test score :"; cin >> score;
switch (score/10)
{
case 10:
case 9: cout << "your grade is an A." << endl; break;
case 8: cout << "your grade is an B." << endl; break;
case 7: cout << "your grade is an C." << endl; break;
case 6: cout << "your grade is an D." << endl; break;
case 5:
case 4:
case 3:
case 2:
case 1:
case 0: cout << "your grade is an F." << endl; break;
default: cout<< "Error:score is out of range.\n";
}
cout << "coodbye." << endl;
2
#include <iostream>
using namespace std;
int main()
{
int ID;
cout << "Name:Ahmed Fouad Mohamed Waghe " << endl;
cout << "________________________________" << endl;
cout << "Enter ID : "; cin >> ID;
cout << "________________________________" << endl;
cout << " program reads hours work and equivealent payment " << endl;
cout << "____________________________________________________" << endl;
int hours;
double pay;
cout << "Enter hours : ";
cin >> hours;
if (hours <= 30)
pay = hours * 15;
else if (hours > 30 & hours <= 50)
pay = 30 * 15 + (hours - 30) * 20;
else if (hours > 50)
pay = 30 * 15 + 20 * 20 + (hours - 50) * 30;
else
cout << "invalid \n";
cout << "payment is : " << pay << "KD\n";
}
3
#include <iostream>
using namespace std;
int main()
{
int ID;
cout << "Name:Ahmed Fouad Mohamed Waghe " << endl;
cout << "________________________________" << endl;
cout << "Enter ID : "; cin >> ID;
cout << "________________________________" << endl;
cout << " SWITCH LANGUAGE " << endl;
cout << "_________________" << endl;
char latter;
cout << "enter the language frist latter " << endl;
cin >> latter;
switch (latter)
{
case 'A': cout << "Arabic" << endl; break;
case 'a': cout << "arabic" << endl; break;
case 'E': cout << "English" << endl; break;
case 'e': cout << "english" << endl; break;
default: cout << "error" << endl;
}
}