Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 240176c

Browse files
Add files via upload
1 parent 00f063f commit 240176c

File tree

65 files changed

+2669
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2669
-0
lines changed
269 KB
Binary file not shown.
194 KB
Binary file not shown.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include<iostream>
2+
#include<iomanip>
3+
4+
using namespace std;
5+
6+
int main(){
7+
float weight;
8+
9+
cout<<"Enter weight in kilograms: ";
10+
cin>>weight;
11+
cout<<endl;
12+
13+
cout<<fixed<<"Weight in Pounds: "<<setprecision(2)<<weight*2.2;
14+
15+
16+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#include<iostream>
2+
3+
using namespace std;
4+
5+
int main(){
6+
string m_name;
7+
float a_price;
8+
float c_price;
9+
float a_sold;
10+
float c_sold;
11+
float percentage;
12+
13+
cout<<"Enter Movie name: ";
14+
getline(cin,m_name);
15+
cout<<endl;
16+
17+
cout<<"Enter Adult ticket price: ";
18+
cin>>a_price;
19+
cout<<endl;
20+
21+
cout<<"Enter Child ticket price: ";
22+
cin>>c_price;
23+
cout<<endl;
24+
25+
cout<<"Enter no. of adult tickets sold: ";
26+
cin>>a_sold;
27+
cout<<endl;
28+
29+
cout<<"Enter no. of child tickets sold: ";
30+
cin>>c_sold;
31+
cout<<endl;
32+
33+
cout<<"Enter percentage of gross amount donated to cahrity: ";
34+
cin>>percentage;
35+
cout<<endl;
36+
cout<<endl;
37+
cout<<endl;
38+
39+
printf("_**__*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*__\n");
40+
cout<<"Movie name:..........................."<<m_name<<endl;
41+
printf("Number of ticekts sold:...............%0.2f\n",a_sold+c_sold);
42+
printf("Gross Amount:.........................$%0.2f\n",(a_sold*a_price)+(c_sold*c_price));
43+
printf("Percentage of gross Amount donated:...%0.2f%%\n",percentage);
44+
printf("Amount donated:.......................$%0.2f\n",((a_sold*a_price)+(c_sold*c_price))/percentage);
45+
printf("Net Sale:.............................$%0.2f\n",(a_sold+c_sold)-( (a_sold*a_price)+(c_sold*c_price))/percentage);
46+
47+
48+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#include<iostream>
2+
using namespace std;
3+
4+
int main(){
5+
string name;
6+
float s1;
7+
float s2;
8+
float s3;
9+
float s4;
10+
float s5;
11+
float avg;
12+
13+
cout<<"Enter name: ";
14+
cin>>name;
15+
cout<<endl;
16+
17+
cout<<"Enter number of test 1: ";
18+
cin>>s1;
19+
cout<<endl;
20+
21+
cout<<"Enter number of test 2: ";
22+
cin>>s2;
23+
cout<<endl;
24+
25+
cout<<"Enter number of test 3: ";
26+
cin>>s3;
27+
cout<<endl;
28+
29+
cout<<"Enter number of test 4: ";
30+
cin>>s4;
31+
cout<<endl;
32+
33+
cout<<"Enter number of test 5: ";
34+
cin>>s5;
35+
cout<<endl;
36+
37+
avg=(s1+s2+s3+s4+s5)/5;
38+
39+
cout<<"Student Name: "<<name;
40+
cout<<endl;
41+
cout<<"Test Scores: "<<" "<<s1<<" "<<s2<<" "<<" "<<s3<<" "<<s4<<" "<<s5;
42+
cout<<endl;
43+
cout<<"Average test score: "<<avg;
44+
45+
46+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#include<iostream>
2+
#include<iomanip>
3+
4+
using namespace std;
5+
6+
struct menuItemType{
7+
string menuItem;
8+
double menuPrice;
9+
};
10+
11+
int main(){
12+
int i;
13+
int food;
14+
int arr[10];
15+
char dec='y';
16+
int p=0;
17+
float sum=0;
18+
float tax=0;
19+
float total=0;
20+
21+
menuItemType m[8]={"Plain Egg",1.45,"Bacon and Egg",2.45,"Muffin",0.99,"French Toast",1.99,"Fruit Basket",2.49,"Cereal",0.69,"Coffee",0.50,"Tea",0.75};
22+
23+
for(i=0;i<8;i++){
24+
cout<<left<<setw(20)<<m[i].menuItem;
25+
cout<<left<<setw(50)<<m[i].menuPrice;
26+
cout<<endl;
27+
}
28+
29+
cout<<endl;
30+
cout<<endl;
31+
32+
while(dec=='y'){
33+
cout<<"Enter number of food: ";
34+
cin>>food;
35+
36+
arr[p++]=food-1;
37+
sum=sum+m[food-1].menuPrice;
38+
39+
cout<<"Would You like to order anything else? (y/n)"<<endl;
40+
cin>>dec;
41+
}
42+
43+
cout<<"Welcome to Johnny's Restaurant"<<endl;
44+
for(int i=0; i<p; i++){
45+
cout<< "\n" <<left<<setw(20)<<setprecision(2)<<m[arr[i]].menuItem<< " $"<<m[arr[i]].menuPrice;
46+
}
47+
tax = sum*5/100;
48+
cout<<left<<setw(20)<<"\nTax";
49+
cout<<" $"<<left<<setw(50)<<tax;
50+
51+
cout<<left<<setw(20)<<"\nAmount Due";
52+
cout<<" $"<<left<<setw(50)<<sum+tax;
53+
54+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#include<iostream>
2+
using namespace std;
3+
4+
struct player{
5+
string name;
6+
int home_runs;
7+
int num_of_hits;
8+
};
9+
10+
11+
int main(){
12+
int dec;
13+
int i;
14+
player p[10]{"Rayyan",12,15,"Arham",16,24,"Nashit",24,11,"Taha",41,22,"Kamran",98,15,"Ahmed",15,14,"Abid",15,67,"Inshal",11,13,"Sarim",56,12,"Samih",45,12};
15+
16+
cout<<"-----MENU-----"<<endl;
17+
cout<<"1. View Record"<<endl;
18+
cout<<"2. Change Record"<<endl;
19+
cin>>dec;
20+
21+
if(dec==1){
22+
23+
for(i=0;i<10;i++){
24+
cout<<endl;
25+
cout<<"Player Name: "<<p[i].name<<endl;
26+
cout<<"Home Runs: "<<p[i].home_runs<<endl;
27+
cout<<"Num of Hits: "<<p[i].num_of_hits<<endl;
28+
}
29+
}
30+
31+
else if(dec==2){
32+
int id;
33+
cout<<"Enter number of Player you want to change between 1-10"<<endl;
34+
cin>>id;
35+
36+
cout<<"Enter name: ";
37+
cin>>p[id].name;
38+
cout<<endl;
39+
40+
cout<<"Enter Home runs: ";
41+
cin>>p[id].home_runs;
42+
cout<<endl;
43+
44+
cout<<"Enter num of hits: ";
45+
cin>>p[id].num_of_hits;
46+
cout<<endl;
47+
cout<<endl;
48+
cout<<endl;
49+
50+
cout<<"SHOWING UPDATED RECORD"<<endl;
51+
52+
for(i=0;i<10;i++){
53+
cout<<endl;
54+
cout<<"Player Name: "<<p[i].name<<endl;
55+
cout<<"Home Runs: "<<p[i].home_runs<<endl;
56+
cout<<"Num of Hits: "<<p[i].num_of_hits<<endl;
57+
}
58+
}
59+
}
476 KB
Binary file not shown.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#include<iostream>
2+
using namespace std;
3+
4+
class shape{
5+
6+
public:
7+
virtual int getArea()=0;
8+
};
9+
10+
class rectangle:public shape{
11+
int area;
12+
13+
public:
14+
rectangle(int a){
15+
area=a;
16+
}
17+
18+
int getArea(){
19+
return area;
20+
}
21+
};
22+
23+
class triangle:public shape{
24+
int area;
25+
26+
public:
27+
triangle(int a){
28+
area=a;
29+
}
30+
31+
int getArea(){
32+
return area;
33+
}
34+
};
35+
36+
int main(){
37+
rectangle ob1(4);
38+
cout<<"Rectangle Area: "<<ob1.getArea()<<endl;
39+
40+
triangle ob2(6);
41+
cout<<"Triangle Area: "<<ob2.getArea()<<endl;
42+
43+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#include<iostream>
2+
using namespace std;
3+
4+
class car{
5+
6+
public:
7+
string model;
8+
int price;
9+
10+
11+
virtual void setPrice(int x)=0;
12+
13+
void setModel(string m){
14+
model=m;
15+
}
16+
17+
int getPrice(){
18+
return price;
19+
}
20+
string getModel(){
21+
return model;
22+
}
23+
};
24+
25+
class color:public car{
26+
27+
public:
28+
void setPrice(int x){
29+
price=x;
30+
}
31+
};
32+
33+
class company:public car{
34+
35+
public:
36+
void setPrice(int x){
37+
price=x;
38+
}
39+
};
40+
41+
int main(){
42+
color ob1;
43+
ob1.setModel("Toyota");
44+
ob1.setPrice(3500);
45+
46+
cout<<"Model: "<<ob1.getModel()<<endl<<"Price: "<<ob1.getPrice();
47+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /