Activity 1 Exercise No. 1
Activity 1 Exercise No. 1
Exercise No. 1
#include <iostream>
int main(){
int age;
cout << "Enter your age: ";
cin >> age;
cout << "You are " << age << " years old." << endl;
cout << "You are too young to play the game." << endl;
system("pause");
return 0;
}
Activity 1
Exercise No. 2
#include <iostream>
int main(){
for(int i = 0; i < 5; i++){
for(int j = 0; j < 5; j++){
cout << "*";
}
cout << endl;
}
system("pause");
return 0;
}
Activity 1
Exercise No. 3
#include <iostream>
int main(){
int x, y;
float z;
cout << "x: ";
cin >> x;
cout << "y: ";
cin >> y;
cout << "z: ";
cin >> z;
system("pause");
return 0;
}
Activity 1
Exercise No. 4
# include <iostream>
int main(){
char name [50];
cout << "Enter your name: ";
cin >> name;
cout <<"Hello " <<name <<endl;
system("pause");
return 0;
}
Activity 1
Exercise No. 5
#include <iostream>
int main(){
int val_one, val_two, val_three;
cout << "val_one: ";
cin >> val_one;
cout << "val_two: ";
cin >> val_two;
cout << "val_three: ";
cin >> val_three;
system("pause");
return 0;
}
Activity 2
Exercise No. 1
#include <iostream>
int main(){
int numberone, numbertwo;
cout << "numberone: ";
cin >> numberone;
cout << "numbertwo: ";
cin >> numbertwo;
system("pause");
return 0;
}
Activity 2
Exercise No. 2
#include <iostream>
int main(){
float salesDiv, salesComp;
cout << "salesdiv: ";
cin >> salesDiv;
cout << "salescomp: ";
cin >> salesComp;
cout << "The total sales generated by the sales division is: $" <<
totalSales << " million" << endl;
system("pause");
return 0;
}
Activity 2
Exercise No. 3
#include <iostream>
int main(){
float purchase, statetax, countrytax;
system("pause");
return 0;
}
Activity 2
Exercise No. 4
#include <iostream>
int main(){
float meal;
float tax;
float tip;
float total;
cout << "The meal charge is: $" << meal << endl;
cout << "The tax amount is: $" << tax << endl;
cout << "The tip amount is: $" << tip << endl;
cout << "The total bill is: $" << total << endl;
system("pause");
return 0;
}
Activity 2
Exercise No. 5
#include <iostream>
int main(){
int val_one, val_two, val_three, val_four, val_five;
cout << "val_one: ";
cin >> val_one;
cout << "val_two: ";
cin >> val_two;
cout << "val_three: ";
cin >> val_three;
cout << "val_four: ";
cin >> val_four;
cout << "val_five: ";
cin >> val_five;
system("pause");
return 0;
}
Activity 2
Exercise No. 6
#include <iostream>
int main(){
float payAmount, payPeriods, annualPay;
cout << "Pay Amount: ";
cin >> payAmount;
cout << "Pay Periods: ";
cin >> payPeriods;
system("pause");
return 0;
}
Activity 2
Exercise No. 7
#include <iostream>
int main(){
float currentLevel, risingLevel;
cout << "Current Level: ";
cin >> currentLevel;
cout << "Rising Level: ";
cin >> risingLevel;
printf("In 5 years, the ocean's level will be %f higher than the current
level. \n", currentLevel + (risingLevel*5));
printf("In 7 years, the ocean's level will be %f higher than the current
level. \n", currentLevel + (risingLevel*7));
printf("In 10 years, the ocean's level will be %f higher than the current
level. \n", currentLevel + (risingLevel*10));
system("pause");
return 0;
}
Activity 2
Exercise No. 8
#include <iostream>
int main(){
char month1[10], month2[10], month3[10];
float rain1, rain2, rain3;
system("pause");
return 0;
}
Activity 2
Exercise No. 9
#include <iostream>
int main(){
char c;
int i;
float f;
double d;
system("pause");
return 0;
}
Activity 2
Exercise No. 10
#include <iostream>
int main(){
float gallons, miles, MPG;
cout << "Enter the number of size of the tank (gallons): ";
cin >> gallons;
cout << "Enter the number of miles per tank of gas: ";
cin >> miles;
MPG = miles/gallons;
cout << "A car that holds " << gallons <<" gallons of gasoline and travel
" << miles << " miles before refueling gets " << MPG << "MPG" << endl;
system("pause");
return 0;
}
Activity 3
Exercise No. 1
#include <iostream>
int main(){
float capacity, miles, average;
cout << "Enter the number of size of the tank (gallons): ";
cin >> capacity;
cout << "Enter the number of miles per tank of gas: ";
cin >> miles;
average = miles/capacity;
cout << "The car's MPG is: " << average << endl;
system("pause");
return 0;
}
Activity 3
Exercise No. 2
#include <iostream>
int main(){
int classA, classB, classC;
cout << "How many tickets were sold for classA? ";
cin >> classA;
cout << "How many tickets were sold for classB? ";
cin >> classB;
cout << "How many tickets were sold for classC? ";
cin >> classC;
system("pause");
return 0;
}
Activity 3
Exercise No. 3
#include <iostream>
int main(){
float score1, score2, score3, score4, score5;
cout << "Enter score 1: ";
cin >> score1;
cout << "Enter score 2: ";
cin >> score2;
cout << "Enter score 3: ";
cin >> score3;
cout << "Enter score 4: ";
cin >> score4;
cout << "Enter score 5: ";
cin >> score5;
system("pause");
return 0;
}
Activity 3
Exercise No. 5
#include <iostream>
#include <string>
int main(){
char movie[50];
float adultTickets, childTickets;
float adultPrice = 6.00, childPrice = 3.00;
float grossBox, netBox, distributorCut;
system("pause");
return 0;
}
Activity 3
Exercise No. 6
#include <iostream>
#include <math.h>
int main(){
float widgetWeight = 9.2;
float palletEmpty, palletWeight;
cout << "How much does the empty pallet weight (pound): ";
cin >> palletEmpty;
cout << "How much does the pallet weight (with widgets): ";
cin >> palletWeight;
system("pause");
return 0;
}
Activity 3
Exercise No. 7
#include <iostream>
int main(){
int cookies;
cout << "Enter the number of cookies you ate: ";
cin >> cookies;
system("pause");
return 0;
}
Activity 3
Exercise No. 8
#include <iostream>
int main(){
int repCost;
cout << "Enter the replacement cost of your building: ";
cin >> repCost;
system("pause");
return 0;
}
Activity 3
Exercise No. 9
#include <iostream>
int main() {
float loanPayment, monthlyTotal, insurance, gas, oil, tires,
maintenance;
#include <iostream>
int main(){
float celsius;
cout << "Enter Celsius Temperature: ";
cin >> celsius;
float fahrenheit = (1.8 * celsius) + 32;
cout << celsius << " Celsius = " << fahrenheit << " Fahrenheit" << endl;
system("pause");
return 0;
}