Find the best solutions to your questions at Westonci.ca, the premier Q&A platform with a community of knowledgeable experts. Get detailed and accurate answers to your questions from a dedicated community of experts on our Q&A platform. Get detailed and accurate answers to your questions from a dedicated community of experts on our Q&A platform.
Sagot :
The program illustrates the use of mathematical operations such as division and addition operations.
The complete program in C++ where comments are used to explain each line is as follows:
#include<iostream>
#include<string>
using namespace std;
int main(){
//This declares name as string
string name, allWeights = " ";
//This gets input for name
cin>>name;
//This declares weight as integer and also initializes the total weight to 0
int weight, total = 0;
//The following iteration gets input for weight
for(int i = 0; i<4;i++){
cin>>weight;
//This calculates the total weight
total+=weight;
//This records all weights
allWeights+= " "+to_string(weight);
}
//This prints the client's name
cout<<"Name: "<<name<<endl;
//This prints the all recorded weights
cout<<"Weights:"<<allWeights<<endl;
//This prints the client's average weight
cout<<"Average weight: "<<total/4;
return 0;
}
At the end of the program, the client's name, all input weights and the average weights are displayed
See attachment for sample run
Read more about similar programs at:
https://brainly.com/question/13439071
Thank you for choosing our platform. We're dedicated to providing the best answers for all your questions. Visit us again. We hope our answers were useful. Return anytime for more information and answers to any other questions you have. Westonci.ca is here to provide the answers you seek. Return often for more expert solutions.