编程题答案汇总
2.7 开始学习C++
- 2.7-1.cpp
#include <iostream>
int main()
{
using namespace std;
cout << "Pls input your name and adress: " << endl;
char name[12],adress[12];
cin >> name;
cin >> adress;
cout << "Your name is " << name << " and your adress is " << adress << endl;
return 0;
}
//output
- 2.7-2.cpp
#include <iostream>
using namespace std;
int main()
{
double long_distance;
cout << "Enter a distance for long unit: ";
cin >> long_distance;
cout << long_distance << " long distance ";
cout << "is equal to ";
long_distance *= 220.0;
cout << long_distance << " yard distance." << endl;
return 0;
}
//output
- 2.7-3.cpp
#include <iostream>
using namespace std;
void blind();
void run();
int main()
{
blind();
blind();
run();
run();
return 0;
}
void blind(){
cout << "Three blind mice" << endl;
}
void run()
{
cout << "See how they run" << endl;
}
//output
- 2.7-4.cpp
#include <iostream>
using namespace std;
int Fahrenheit(int);
int main()
{
int cei;
cout << "Please enter a Celsius value: ";
cin >> cei;
int Fa = Fahrenheit(cei);
cout << cei << " degrees Celsius is " << Fa << " degrees Fahrenheit." << endl;
return 0;
}
int Fahrenheit(int Ceisius)
{
int Fahrenheits,Ceisiuss;
Fahrenheits = 1.8 * Ceisiuss + 32.0;
}
//output
- 2.7-5.cpp
#include <iostream>
using namespace std;
double astron(double);
int main()
{
double l;
cout << "Enter the number of light years: ";
cin >> l;
double a = astron(l);
cout << l << " light years = " << a << " astronmical units." << endl;
return 0;
}
double astron(double light_year)
{
double as;
as = 63240 * light_year;
return as;
}
//output
- 2.7-6.cpp
#include <iostream>
using namespace std;
void Time_h_m(int,int);
int main()
{
int hour,min;
cout << "Enter the number of hours: ";
cin >> hour;
cout << "Enter the number of minutes: ";
cin >> min;
Time_h_m(hour, min);
return 0;
}
void Time_h_m(int h, int m)
{
cout <<"Time: " << h << ":" << m;
}
//output
3.7
- 3.7-1.cpp
#include <iostream>
using namespace std;
int main()
{
const float zhuanhuan = 0.083;
int h;
cout << "Pls input :______\b\b\b\b\b\b";
cin >> h;
cout << "Your height is " << h << "(inches), is " << h * zhuanhuan << "(feet)";
}
//output
- 3.7-2.cpp
#include <iostream>
using namespace std;
int main()
{
const double mi = 0.0254;
const double bang = 1/2.2;
const int inch = 12;
double in, inc, ba;
cout << "Pls input your height: ";
cin >> in >> inc;
cout << "Your weight is ";
cin >> ba;
cout << "Your height is " << in + inc * inch << " inchs" << endl;
double meter = (inc * inch + in) * mi;
cout << "Your BMI = " << (ba * bang) / (meter * meter) << "." << endl;
return 0;
}
// output
- 3.7-3.cpp
#include <iostream>
using namespace std;
int main()
{
double degree, minute, second;
const double H_min = 60.0;
const double H_sec = 60.0;
cout << "Ente a latitude in degrees, minutes, and seconds: " << endl;
cout << "First, enter the degrees: ";
cin >> degree;
cout <<"Next, enter the minutes of arc: ";
cin >> minute;
cout << "Finally, enter the seconds of arc: ";
cin >> second;
cout << degree << " degrees, " << minute << " mintues, " << second << " seconds = " << degree + (minute/H_min) + (second/(H_min * H_sec)) << " degrees";
return 0;
}
// output
- 3.7-4.cpp
#include <iostream>
using namespace std;
int main()
{
const int day_hour = 24;
const int hour_mintue = 60.0;
const int mintue_second = 60.0;
long s;
cout << "Enter the number of seconds: ";
cin >> s;
cout << s << " seconds = " << s/(mintue_second * hour_mintue * day_hour) << " days, " ;
cout << s/(mintue_second * hour_mintue) % day_hour << " hours, ";
cout << s/mintue_second % mintue_second << " mintues, ";
cout << s % mintue_second << " seconds.";
return 0;
}
//output
- 3.7-5.cpp
#include <iostream>
using namespace std;
int main()
{
double mile, gallon;
cout << "Please your mile and gallon: ";
cin >> mile >> gallon;
cout << "Your oil consumption is " << gallon / mile << "(gallon/mile)" << endl;
double kilometre, l;
cout << "Please your kil and l: ";
cin >> kilometre >> l;
cout << "Your oil consumption is " << l / kilometre << "(l/kilometre)";
return 0;
}
//output
- 3.7-6.cpp
#include <iostream>
using namespace std;
int main()
{
const double MILE_PER_KM = 0.6214;
const double LITER_PER_GALLON = 3.875;
double kilometre, l;
// double mile, gallon;
cout << "Please your Europe kil : ";
cin >> kilometre;
cout << "Please your Europe gas consumption : ";
cin >> l;
cout << "Your consume " << l/kilometre*100;
cout << " liter gas for driving per 100 km (European style)." << endl;
cout << "You drive " << kilometre * MILE_PER_KM / l * LITER_PER_GALLON;
cout << " miles for per gallon (American style)." << endl;
return 0;
}
// output
4.11
- 4.11-1.cpp
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
int main()
{
char first[20];
string last;
char grade;
int age;
cout << "What is your first name? ";
cin >> first;
cout << "What is your last name? ";
cin >> last;
cout << "What letter grade do you deserve? ";
cin >> grade;
cout << "What is your age? ";
cin >> age;
cout << "Name: " << last << ", " << first << endl;
cout << "Grade: " << (char)(grade+1) << endl;
cout << "Age: " << age;
return 0;
}
//output
- 4.11-2.cpp
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
int main()
{
string name;
string dessert;
cout << "Enter your name:\n";
cin >> name;//getline(cin, name);
cout << "Enter your favorite dessert: \n";
cin >> dessert;//getline(cin, dessert);
cout << "I have some delicious " << dessert;
cout << " for you. " << name << ".\n";
return 0;
}
- 4.11-3.cpp
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
int main()
{
const int Asize = 20;
char first[Asize];
char last[Asize];
cout << "Enter your first name: ";
cin.getline(first, Asize);;
cout << "Enter your last name: ";
cin.getline(last, Asize);
char * name = new char [strlen(first) + strlen(last) + 5];
strcpy(name, last);
strcpy(name, ", ");
strcpy(name, first);
cout << "Here's the information in a single string: " << name << endl;
delete [] name;
return 0;
}
//output
- 4.11-4.cpp
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
int main()
{
string first, last;
cout << "Enter your first name: ";
getline(cin, first);
cout << "Enter your last name: ";
getline(cin, last);
last += ", " + first;
cout << "Here's the information in a single string: " << last << endl;
return 0;
}
// output
- 4.11-5.cpp
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
struct CandyBar
{
string band;
double weight;
int cal;
};
int main()
{
CandyBar snack =
{
"Mocha Munch",
2.3,
350,
};
cout << snack.band << endl;
cout << snack.weight << endl;
cout << snack.cal << endl;
return 0;
}
// output
- 4.11-6.cpp
#include <iostream>
#include <string>
using namespace std;
struct CandyBar
{
string band;
double weight;
int cal;
};
int main()
{
CandyBar cake[3] =
{
{"Mocha", 8.2, 200},
{"NNNN", 3.2, 300},
{"OSDSD", 4.3, 400}
};
cout << "The No.1 cake band is "<< cake[0].band << endl;
cout << "The No.1 cake weight is "<< cake[0].weight << endl;
cout << "The No.1 cake cal is "<< cake[0].cal << endl;
cout << "The No.2 cake band is "<< cake[1].band << endl;
cout << "The No.2 cake weight is "<< cake[1].weight << endl;
cout << "The No.2 cake cal is "<< cake[1].cal << endl;
cout << "The No.3 cake band is "<< cake[2].band << endl;
cout << "The No.3 cake weight is "<< cake[2].weight << endl;
cout << "The No.3 cake cal is "<< cake[2].cal << endl;
return 0;
}
// output
- 4.11-7.cpp
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
struct Pizza
{
string Pizza_band;
double Pizza_diameter;
double Pizza_weight;
};
int main()
{
Pizza snack;
cout << "Please input the name of Pizza company: ";
getline(cin, snack.Pizza_band);
cout << "Please inout the diameter of Pizza: ";
cin >> snack.Pizza_diameter;
cout << "Please input the weight of Pizza: ";
cin >> snack.Pizza_weight;
cout << "The Pizza company name is: " << snack.Pizza_band << endl;
cout << "The Pizza company diameter is: " << snack.Pizza_diameter << endl;
cout << "The Pizza company weight is: " << snack.Pizza_weight << endl;
return 0;
}
//output
- 4.11-8.cpp
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
struct Pizza
{
string Pizza_band;
double Pizza_diameter;
double Pizza_weight;
};
int main()
{
Pizza * snack = new Pizza;
cout << "Please input the Pizza diameter: ";
(cin >> snack->Pizza_diameter).get();
cout << "Please input the Pizza band: ";
getline(cin, snack->Pizza_band);
cout << "Please input the Pizza weight: ";
cin >> snack->Pizza_weight;
cout << "The Pizza company name is " << snack->Pizza_band << endl;
cout << "The Pizza company diameter is " << snack->Pizza_diameter << endl;
cout << "The Pizza company weight is " << snack->Pizza_weight << endl;
delete snack;
return 0;
}
// output
- 4.11-9.cpp
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
struct Pizza
{
string Pizza_band;
double Pizza_diameter;
double Pizza_weight;
};
int main()
{
Pizza * snack = new Pizza[3];
snack[0] = {"oooo", 23.2, 344};
snack[1] = {"aaa", 21.1, 442};
snack[2] = {"zxzx", 43.1, 554};
cout << "The No.1 snack name is " << snack[0].Pizza_band << endl;
cout << "The No.1 snack diameter is " << snack[0].Pizza_diameter << endl;
cout << "The No.1 snack weight is " << snack[0].Pizza_weight << endl;
cout << "The No.2 snack name is " << snack[1].Pizza_band << endl;
cout << "The No.2 snack diameter is " << snack[1].Pizza_diameter << endl;
cout << "The No.2 snack weight is " << snack[1].Pizza_weight << endl;
cout << "The No.3 snack name is " << snack[2].Pizza_band << endl;
cout << "The No.3 snack diameter is " << snack[2].Pizza_diameter << endl;
cout << "The No.3 snack weight is " << snack[2].Pizza_weight << endl;
delete [] snack;
return 0;
}
//output
5.9
- 5.9-1.cpp
#include <iostream>
using namespace std;
int main()
{
int i,j,sum;
cin >> i >> j;
sum = i;
for (i;i < j;i++)
sum += (i+1);
cout << "Sum = " << sum;
return 0;
}
// output
- 5.9-2.cpp
#include <iostream>
using namespace std;
int main()
{
int i;
int sum = 0;
do
{
cin >> i;
sum += i;
cout << "Sum is " << sum << endl;
}while(i != 0);
return 0;
}
// output
- 5.9-3.cpp
#include <iostream>
using namespace std;
int main()
{
int year = 1;
double Daphne = 110;
double Cleo_yinli = 100 + 100*0.05;
for (year;Cleo_yinli <= Daphne;year++)
{
Daphne += 10;
Cleo_yinli += (Cleo_yinli*0.05);
}
cout << "No." << year << "have exceeded.";
return 0;
}
//output
- 5.9-4.cpp
#include <iostream>
using namespace std;
int main()
{
const int Asize = 12;
const string months[Asize] =
{
"January", "February", "March", "April",
"May", "June", "July", "August",
"September", "October", "November", "December"
};
int sale[Asize];
int s = 0;
for(int i=0;i < Asize;i++)
{
cout << "Enter input the amounts of " << months[i] << " the C++ For Fools: ";
cin >> sale[i];
s += sale[i];
}
cout << "The amounts of year is " << s;
return 0;
}
//output
- 5.9-5.cpp
#include <iostream>
using namespace std;
int main()
{ const int year = 3;
const int Asize = 12;
const string months[Asize] =
{
"January", "February", "March", "April",
"May", "June", "July", "August",
"September", "October", "November", "December"
};
int sale[3][Asize];
int s = 0;
int s_year[year];
for(int j=0;j < 3;j++)
{
s_year[j] = 0;
for(int i=0;i < Asize;i++)
{
cout << "Enter input the amounts of the No." << j+1 << " of " << months[i] << " the C++ For Fools: ";
cin >> sale[j][i];
s_year[j] += sale[j][i];
}
cout << "The amounts of year is " << s_year[j] << endl;
s += s_year[j];
}
cout << "The 3 year sum id " << s;
return 0;
}
//output
- 5.9-6.cpp
#include <iostream>
using namespace std;
struct car
{
string producer;
int year;
};
int main()
{
int amount;
cout << "How many cars do you wish to catalog? ";
cin >> amount;
car * car_nn = new car[amount];
for(int i=0;i < amount;i++)
{
cout << "Car #" << i+1 << ":" << endl;
cout << "Please enter the make:";
cin >> car_nn[i].producer;
cout << "Please enter the year made:";
cin >> car_nn[i].year;
}
cout << "Here is your collection:" << endl;
for(int i=0;i < amount;i++)
{
cout << car_nn[i].year << " " << car_nn[i].producer << endl;
}
delete [] car_nn;
return 0;
}
//output
- 5.9-7.cpp
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
const int Asize = 256;
char ch[Asize];
unsigned int count = 0;
cout << "Enter words (to stop, type the word done): " << endl;
while (cin >> ch, strcmp("done", ch)) //!!!!!!
{
++count;
}
cout << "You entered a total of " << count << " words." << endl;
return 0;
}
//output
- 5.9-8.cpp
#include <iostream>
#include <string>
using namespace std;
int main()
{
string ch;
unsigned int count = 0;
cout << "Enter words (to stop, type the word done): " << endl;
while (cin >> ch, ch != "done") //!!!!!!
{
++count;
}
cout << "You entered a total of " << count << " words." << endl;
return 0;
}
//output
- 5.9-9.cpp
#include <iostream>
using namespace std;
int main()
{
int count;
cout << "Enter number of rows: ";
cin >> count;
for(int i=1;i <= count;i++)
{
for(int j = i;j <= count-1;j++)
{
cout << ".";
}
for(int j = 1;j <= i;j++)
{
cout << "*";
}
cout << endl;
}
return 0;
}
//output
6.11
- 6.11-1.cpp
#include <iostream>
#include <cctype>
using namespace std;
int main()
{
char ch;
while((ch = cin.get())!='@')
{
if(islower(ch))
ch = toupper(ch);
else
ch = tolower(ch);
if(!isdigit(ch))
cout << ch;
}
return 0;
}
//output
- 6.11-2.cpp
#include <iostream>
#include <array>
using namespace std;
const int SIZE = 10;
int main()
{
array<double,SIZE>arr_dou;
unsigned i, count, count_dou;
double sum;
i = count = count_dou = 0;
sum = 0.0;
while(i<SIZE&&cin>>arr_dou[i])
{
count++;
sum += arr_dou[i++];
}
sum /= count;
for(i = 0;i<SIZE;i++)
{
if(arr_dou[i]>sum)
count_dou++;
}
cout << fixed;
cout.precision(2);
cout.setf(ios_base::showpoint);
cout << "average value: " << sum
<< " A total of " << count_dou
<< " numbers are greater than the average.";
return 0;
}
//output
- 6.11-3.cpp
#include <iostream>
using namespace std;
void Menu();
int main()
{
char ch;
Menu();
while(cin.get(ch))
{
switch (ch)
{
case 'c': cout << "A maple is a carnivore." << endl;
break;
case 'p': cout << "A maple is a pianist." << endl;
break;
case 't': cout << "A maple is a tree." << endl;
break;
case 'g': cout << "A maple is a game." << endl;
break;
default: cout << "Please enter a c, p, t, or g: " << endl;
while((ch = cin.get())!='\n')
continue;
}
while((ch = cin.get())!='\n')
continue;
Menu();
}
return 0;
}
void Menu()
{
cout << "Please enter one of the following chioces: " << endl;
cout << "c)carnivore p)pianist" << endl;
cout << "t)tree q)game" << endl;
}
//output
- 6.11-4.cpp
#include <iostream>
using namespace std;
void Menu();
const int strsize = 80;
const int SIZE = 4;
struct bop
{
char fullname[strsize];
char title[strsize];
char bopname[strsize];
int preference;
};
int main()
{
char choice;
bop bop_name[SIZE]
{
{"Davis", "Registered Architect", "Harper", 1},
{"Miller", "Builders", "Sylvia", 0},
{"Smith", "veterinarian", "Ashley", 2},
{"Garcia", "teacher", "Astrid", 0}
};
cout << "Benevolent Order of Programmers Report" << endl;
Menu();
cout << "Enter your chioce: ";
while ((choice = cin.get()) != 'q')
{
switch (choice)
{
case 'a':
cout << "Wimp Macho" << endl;
for(int i = 0;i<SIZE;i++)
{
cout << bop_name[i].fullname << endl;
}
break;
case 'b':
cout << "Wimp Macho" << endl;
for(int i = 0;i<SIZE;i++)
{
cout << bop_name[i].title << endl;
}
break;
case 'c':
cout << "Wimp Macho" << endl;
for(int i = 0;i<SIZE;i++)
{
cout << bop_name[i].bopname << endl;
}
break;
case 'd':
cout << "Wimp Macho" << endl;
for(int i = 0;i < SIZE;i++)
{
if(bop_name[i].preference == 0)
cout << bop_name[i].fullname << endl;
else if(bop_name[i].preference == 1)
cout << bop_name[i].title << endl;
else
cout << bop_name[i].bopname << endl;
}
break;
default:
cout << "Please input a a, b, c, d(q is quit): ";
while((choice=cin.get())!='\n');
continue;
}
while((choice=cin.get())!='\n');
cout << "Next choice: ";
}
cout << "Bye!";
return 0;
}
void Menu()
{
cout << "a. display by name b. display by title" << endl;
cout << "c. display by bopname d. display by preference" << endl;
cout << "q. quit" << endl;
}
//output
- 6.11-5.cpp
#include <iostream>
#include <cctype>
using namespace std;
int main()
{
int num;
cout << "Please enter your income: ";
// cin >> num;
while(std::cin>>num&&num>=0)
{
if(num<=5000)
cout << "Your personal income tax is 0 tvarps." << endl;
else if(num>=5001&&num<=15000)
cout << "Your personal income tax is " << (num-5000)*0.1 << " tvarps." << endl;
else if(num>=15001&&num<=35000)
cout << "Your personal income tax is " << 10000*0.1+(num-15000)*0.15 << " tvarps." << endl;
else if(num>=35000)
cout << "Your personal income tax is " << 10000*0.1+20000*0.15+(num-35000)*0.2 << " tvarps." << endl;
}
return 0;
}
//output
- 6.11-6.cpp
#include <iostream>
#include <string>
using namespace std;
struct organ
{
std::string name;
double amount;
};
const int SIZE{3};
int main()
{
organ str_name[SIZE];
int i, count_s;
i = count_s = 0;
while(i < SIZE)
{
cout << "Please enter the name of the donor: ";
getline(cin, str_name[i].name);
cout << "Please enter the donation amount: ";
cin >> str_name[i].amount;
str_name[i].amount > 9999 ? count_s++ : count_s;
i++;
cin.get();
}
cout << "\nGrand Patrons\n";
if(count_s != 0)
{
for(i = 0;i < SIZE;i++)
if(str_name[i].amount > 9999)
cout << str_name[i].name << endl
<< str_name[i].amount << endl;
}
else
cout << "none\n";
cout.put('\n');
cout << "Patrons\n";
if(count_s == 0 || count_s != SIZE)
{
for(i = 0;i < SIZE;i++)
if(str_name[i].amount < 10000)
cout << str_name[i].name << endl
<< str_name[i].amount << endl;
}
else
cout << "none\n";
return 0;
}
//output
- 6.11-7.cpp
#include <iostream>
#include <cctype>
int const SIZE{ 80 };
int main()
{
using namespace std;
char str[SIZE];
int count_y, count_f;
count_f = count_y = 0;
while(cin >> str)
{
if(str[1] == '\0' && str[0] == 'q')
break;
if(isalpha(str[0]))
{
switch(str[0])
{
case 'a':
case 'e':
case 'o':
case 'i':
case 'u':
case 'A':
case 'E':
case 'O':
case 'I':
case 'U':count_y++; break;
default:count_f++; break;
}
}
}
cout << count_y << " words beginning with vowels\n"
<< count_f << " words beginning with consonants\n";
return 0;
}
//output
- 6.11-8.cpp
#include <iostream>
#include <fstream>
#include <cstdlib>
int main()
{
using namespace std;
ifstream ifFile;
char choice;
int count = 0;
ifFile.open("car.txt");
if(!ifFile.is_open())
{
exit(1);
}
ifFile.get(choice);
while(ifFile.good())
{
++count;
ifFile.get(choice);
}
if(ifFile.eof())
cout << "End of file reached.\n";
else if(ifFile.fail())
cout << "error";
cout << count;
return 0;
}
//output
- 6.11-9.cpp
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string>
struct organ
{
std::string name;
double amount;
};
int main()
{
using namespace std;
ifstream inFile;
int temp;
organ str_name[4];
int i = 0;
inFile.open("car.txt");
if(!inFile.is_open())
{
exit(1);
}
inFile >> temp;
inFile.get();
while(inFile.good() && i < 4)
{
getline(inFile,str_name[i].name);
inFile >> str_name[i++].amount;
inFile.get();
}
cout << temp << endl;
cout << fixed;
cout.precision(2);
cout.setf(ios_base::showpoint);
for(i = 0;i < 4;i++)
{
cout << str_name[i].name << endl
<< str_name[i].amount << endl;
}
return 0;
}
//output
7.12
- 7.12-1.cpp
#include <iostream>
using namespace std;
double average(double x, double y);
int main()
{
double a, b;
cout << "Please input two numbers (if number is zero,stop): ";
cin >> a;
cin >> b;
while(a && b)
{
cout << "Harmonic mean of " << a << " and " << b << " = " << average(a, b) << endl;
cout << "Enter agen(if one is zero, stop): ";
(cin >> a) >> b;
}
system("pause");
return 0;
}
double average(double x, double y)
{
return 2.0 * x * y / (x + y);
}
//output
- 7.12-2.cpp
#include <iostream>
using namespace std;
const int SIZE = 10;
int fillScore(double* score);
void display(double* score, int n);
double getAverage(double* score,int n);
int main()
{
double scores[10] = {0};
int n = fillScore(scores);
display(scores, n);
cout << "AVERAGESCORE: " << getAverage(scores, n) << endl;
system("pause");
return 0;
}
int fillScore(double* score)
{
cout << "Please enter the scores(maximum quantity=10)," << endl;
cout << "If you want to end the input, enter a latter!" << endl;
double value;
int i;
for(i = 0;i < 10;i++)
{
cout << "enter the " << i + 1 << " Score:";
if(i > 9)
break;
else
{
if(cin >> value)
score[i] = value;
else
break;
}
}
cout << "QUANTITY: " << i << endl;
return i;
}
void display(double* score, int n)
{
cout << "SCORES: ";
for(int i = 0;i < n;i++)
cout << score[i] << " ";
cout << endl;
}
double getAverage(double* score,int n)
{
double sum = 0;
for(int i = 0;i < n;i++)
sum += score[i];
return sum / n;
}
//output
- 7.12-3.cpp
#include <iostream>
using namespace std;
struct box
{
char maker[40];
float height;
float width;
float length;
float volume;
};
void display(box bx);
void calculationBoxVolume(box* pbox);
int main()
{
box bx = { "jianmo1993", 1.0, 1.0, 1.0, 0.0};
calculationBoxVolume(&bx);
display(bx);
system("pause");
return 0;
}
void display(box bx)
{
cout << "BOX'S INFORMATION:" << endl;
cout << "maker: " << bx.maker << endl;
cout << "height: " << bx.height << endl;
cout << "width: " << bx.width << endl;
cout << "length: " << bx.volume << endl;
cout << "volume: " << bx.volume << endl;
}
void calculationBoxVolume(box* pbox)
{
pbox->volume = pbox->height * pbox->length * pbox->width;
}
//output