Please see the image attached but I am having compiling issues (instructions on what the objective is is below): Introduction to Programming (C++): Create a program with three vectors (be sure to use: #include ) : One vector for the last name One vector for the first name One vector for the age of the person (whole number) **You determine what sentinel value to use to stop input** So input different kinds of people (first name, last name, and age) until you get to the sentinel value and then output the list of people Calculate the average age of the people and then calculate the Standard Deviation of the ages. Expect to see the means, a function to display the list of names and ages, a function to get the average, and a function to calculate the Standard Deviation **Please use at least 10 people** --------------------------------------------------------------------------------- #include #include #include // Defines various mathematical functions using namespace std; // Functions void func_display(vector& v1, vector& v2, vector& v3); void func_average(vector& v3); void func_std(vector& v3, float avg_ages); void func_display(vector& v1, vector& v2, vector& v3) { // Since all of the vectors are of the same size, the size of any vector can be used cout << "\n PERSON DETAILS"; for (int i = 0; i < v1.size(); i++) { cout << "\nName: " << v1[i] << " " << v2[i]; cout << "\nAge: " << v3[i]; } } void func_average(vector& v3) { int sumAges = 0; cout << "\n COMPUTE AVERAGE AND STANDARD DEVIATION OF AGES"; for (int i = 0; i < v3.size(); i++) sumAges += v3[i]; float avg = (float)sumAges / v3.size(); // Display average cout << "\nAverage: " << avg; // Call the method to show the Standard Deviation func_std(v3, avg); } void func_std(vector& v3, float avg_ages) { float var_ages, st_deviation; for (int i = 0; i < v3.size(); i++) var_ages += pow(v3[i] - avg_ages, 2); var_ages = var_ages / v3.size(); st_deviation = sqrt(var_ages); cout << "\nStandard Deviation:" << st_deviation; } int main() { vectorlast_name; vectorfirst_name; vectorage; int answer, p_age; string l_name, f_name; // Input values until the sentinel value(0) is obtained while (true) { // Last name below cout << "Enter the last name of the individual: "; cin >> l_name; last_name.push_back(l_name); // First name below cout << "Enter the first name of the individual: "; cin >> f_name; first_name.push_back(f_name); // Person's age below cout << "Enter the age of the individual: "; cin >> p_age; age.push_back(p_age); // Require more values? cout << "\nRequire more values? (press 0 to exit OR 1 to continue):"; cin >> answer; if (answer == 0) break; } func_display(first_name, last_name, age); func_average(age); return 0; }
Please see the image attached but I am having compiling issues (instructions on what the objective is is below):
Introduction to Programming (C++):
Create a program with three
One vector for the last name
One vector for the first name
One vector for the age of the person (whole number)
**You determine what sentinel value to use to stop input**
So input different kinds of people (first name, last name, and age) until you get to the sentinel value and then output the list of people
Calculate the average age of the people and then calculate the Standard Deviation of the ages.
Expect to see the means, a function to display the list of names and ages, a function to get the average, and a function to calculate the Standard Deviation
**Please use at least 10 people**
---------------------------------------------------------------------------------
#include <iostream>
#include <vector>
#include <math.h> // Defines various mathematical functions
using namespace std;
// Functions
void func_display(vector<string>& v1, vector<string>& v2, vector<int>& v3);
void func_average(vector<int>& v3);
void func_std(vector<int>& v3, float avg_ages);
void func_display(vector<string>& v1, vector<string>& v2, vector<int>& v3)
{
// Since all of the vectors are of the same size, the size of any vector can be used
cout << "\n PERSON DETAILS";
for (int i = 0; i < v1.size(); i++)
{
cout << "\nName: " << v1[i] << " " << v2[i];
cout << "\nAge: " << v3[i];
}
}
void func_average(vector<int>& v3)
{
int sumAges = 0;
cout << "\n COMPUTE AVERAGE AND STANDARD DEVIATION OF AGES";
for (int i = 0; i < v3.size(); i++)
sumAges += v3[i];
float avg = (float)sumAges / v3.size();
// Display average
cout << "\nAverage: " << avg;
// Call the method to show the Standard Deviation
func_std(v3, avg);
}
void func_std(vector<int>& v3, float avg_ages)
{
float var_ages, st_deviation;
for (int i = 0; i < v3.size(); i++)
var_ages += pow(v3[i] - avg_ages, 2);
var_ages = var_ages / v3.size();
st_deviation = sqrt(var_ages);
cout << "\nStandard Deviation:" << st_deviation;
}
int main()
{
vector<string>last_name;
vector<string>first_name;
vector<int>age;
int answer, p_age;
string l_name, f_name;
// Input values until the sentinel value(0) is obtained
while (true)
{
// Last name below
cout << "Enter the last name of the individual: ";
cin >> l_name;
last_name.push_back(l_name);
// First name below
cout << "Enter the first name of the individual: ";
cin >> f_name;
first_name.push_back(f_name);
// Person's age below
cout << "Enter the age of the individual: ";
cin >> p_age;
age.push_back(p_age);
// Require more values?
cout << "\nRequire more values? (press 0 to exit OR 1 to continue):";
cin >> answer;
if (answer == 0)
break;
}
func_display(first_name, last_name, age);
func_average(age);
return 0;
}
![Error List
w ♥ 4 X
Entire Solution
X 1 Error
4 Warnings
1 O Messages
Build + IntelliSense
Search Error List
Description A
'<': signed/unsigned mismatch
Code
File
Project
Assign 10
Line Suppression State
А (4018
Assign 10.cpp
19
A C4018
'<': signed/unsigned mismatch
Assign 10
Assign 10.cpp
30
A C4018
'<': signed/unsigned mismatch
Assign 10
Assign 10.cpp
42
X C4700
uninitialized local variable 'var_ages' used
Assign 10
Assign 10.cpp
43
DA C6001
Using uninitialized memory 'var_ages'.
Assign 10
Assign 10.cpp
44](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F5643f6a4-a7a4-4b03-93d4-ff1f1b43abe4%2F3508e3b3-37c7-4f3b-b619-0dc33fc9401f%2Falwxey_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)