#include <iostream>
#include <string>
#include <vector>
using namespace std;
string get_string_input(vector<string> strings);
float averageFunc(vector<float> floating);int main()
{
cout << "enter a word. When you're done, enter done." << endl;
vector<string> strings;
string input;
while (input != "done")
{
cin >> input;
if (input == "done")
break;
else
strings.push_back(input);
} cout << "your sentence is: ";
for (int i = 0; i < strings.size(); i++) {
// how to output return val from get_string_input
cout << "enter a num. When you're done, enter 10001." << endl;
vector<float> floating;
float num; while (num != 10001)
{
cin >> num;
if (num == 10001)
break;
else
floating.push_back(num);
}
// how to output return val from averageFunc system("pause");
return 0;
}
/*
The first function will be get_string_inputs, which will return a vector of strings.
This function should continually loop, taking input from cin, and putting that into
the vector that will be returned. It should take one parameter, which is the string
to take in that will denote that input should stop being received. When this input
is found, the function will return the vector.
*/
string get_string_input(vector<string> strings) { string s;
for (int i = 0; i < strings.size(); i++) {
s = strings[i];
cout << s << " ";
}
return s;
}
/*
The second function will be an average function. This function should
take a vector of floats as input, and return a single float value that
is the average of the vector passed in.
*/
float averageFunc(vector<float> floating) {
float total = 0.0;
for (int i = 0; i < floating.size(); i++) {
total += floating[i];
}
float avrg = total / floating.size(); // average of vector
return avrg;
}