1 // This program uses a type cast expression to print a character
2 // from a number.
3 #include
4 using namespace std;
6 int main()
7 {
8 int number = 65;
10 // Display the value of the number variable.
11 cout << number << endl;
13 // Display the value of number converted to
14 // the char data type.
15 cout << static_cast(number) << endl;
16 return 0; }
#include
using namespace std;
int main()
{
float number_of_gallons;
float number_of_miles;
float miles_per_gallon;
cout<<"__________________________________"<>number_of_gallons;
cout<<"Enter the number of miles driven:"<>number_of_miles;
//Calculations
miles_per_gallon=number_of_miles/number_of_gallons;
//Display
cout<<"The miles per gallon diven by the car = "<
#include
#include
using namespace std;
int main()
{
const int cost_A=15;
const int cost_B=12;
const int cost_C=9;
int A,B,C;
float income;
cout<<"__________________________________"<>A;
cout<<"Enter the number of tickets sold for class_B categary:"<>B;
cout<<"Enter the number of tickets sold for class_C categary:"<>C;
//Calculations
cout<
#include
#include
using namespace std;
int main()
{
int a,b,c,d,e;
float average;
cout<<"__________________________________"<>a;
cout<<"Enter the score 2:"<>b;
cout<<"Enter the score 3:"<>c;
cout<<"Enter the score 4:"<>d;
cout<<"Enter the score 5:"<>e;
//Calcualtions
average=(float)(a+b+c+d+e)/5;
cout<
Write a program that calculates the average rainfall for three months. The program
should ask the user to enter the name of each month, such as June or July, and the
amount of rain (in inches) that fell each month. The program should display a message
similar to the following:
The average rainfall for June, July, and August is 6.72 inches.
#include
#include
using namespace std;
int main()
{
string month1,month2,month3;
float rain_inche1=0.0;
float rain_inche2=0.0;
float rain_inche3=0.0;
float average=0.0;
cout<<"__________________________________"<>month1;
cout<<"Now enter its rainfall per inches:"<>rain_inche1;
cout<<"Enter the name of month :2"<>month2;
cout<<"Now enter its rainfall per inches:"<>rain_inche2;
cout<<"Enter the name of month :3"<>month3;
cout<<"Now enter its rainfall per inches:"<>rain_inche3;
//Calcualtions
average=(rain_inche1+rain_inche2+rain_inche3)/3 ;
//Display
cout<<"The average rainfall for "<
#include
using namespace std;
int main()
{
int male=0;
int female=0;
int total=0;
float male_per=0.0;
float female_per=0.0;
cout<<"Class male and female percentage:"<>male;
cout<<"Enter the number of females in your class:"<>female;
//Percentage Calculation
total=male+female;
male_per=((float)male/total)*100;
female_per=((float)female/total)*100;
cout<<"The total number of students in your classroom = "<
A cookie recipe calls for the following ingredients:
• l.5 cups of sugar
• 1 cup of butter
• 2. 75 cups of flour
The recipe produces 48 cookies with this amount of the ingredients.
Write a program that asks the user how many cookies he or she wants to make, then displays the
number of cups of each ingredient needed for the specified number of cookies.
The output is as follows:
Ingrediant_Calculator:
______________________
Enter the number of cookies that you want to make:
700
The ingrediants you need to make the 700 number of cookies :
You need 21.9 cups_of_sugar
You need 14 cups_of_butter
You need 40.1 cups_of_flour
#include
#include
using namespace std;
int main()
{
float cups_of_sugar=1.5;
int cups_of_butter=1;
float cups_of_flour=2.75;
int total_cookies=48;
int cookies=0;
cout<<"Ingrediant_Calculator:"<>cookies;
//Ingrediants_Calculation
cups_of_sugar=(cups_of_sugar*cookies)/total_cookies;
cups_of_butter=((float)cups_of_butter*cookies)/total_cookies;
cups_of_flour=(cups_of_flour*cookies)/total_cookies;
cout<<"The ingrediants you need to make the "<
#include
#include
using namespace std;
int main()
{
const int theater_keeps=20;
const float cost_adult=10.00;
const float cost_child=6.00;
string movie_name;
int adult_tickets=0;
int child_tickets=0;
float gross=0.0;
double net=0.0;
double amount_paid=0.0;
cout<<"--------------BOX_OFFICE-----------"<>adult_tickets;
cout<<"Enter the number of Child_ticksts sold:"<>child_tickets;
//calculations
gross=(cost_adult*adult_tickets)+(cost_child*child_tickets);
net=((float)20/100)*gross;
amount_paid=gross-net;
cout<
#include
using namespace std;
int main()
{
float indiv_weight_pallet,
pallet_weight_with_widgets,
weight_of_widgets,
indiv_weight_of_widgets=12.5,
num_of_widgets;
cout<<"__________________________________"<> indiv_weight_pallet;
cout<<"Enter the Weight of the pallet with the widgets in pounds:"<> pallet_weight_with_widgets;
//Calculations
weight_of_widgets=(pallet_weight_with_widgets)-(indiv_weight_pallet);//Calculate wight of widgtes
num_of_widgets=weight_of_widgets/indiv_weight_of_widgets;
//display
cout<<"The number of widgets stacked to the pallet = "<
#include
#include
using namespace std;
int main()
{
cout<
#include
#include
using namespace std;
iint main()
{
const int characters_per_second=960;
const int sizeOfCharacter_per_byte=1;
long long int file_bytes=419430400;
long double days=0.0;
cout<<"------------File Sendig Time/400MB--------"<