It would be greatly appreciated if you guys help me fix these syntax errors. Just in case you have any questions regrading the application its suppose to collect numbers and end with a press of the enter key. Once that happens, its suppose to show the mean, median, and mode (I have not added those yet, fyi).
#include <iostream>
#include <string>
#include <vector>
usingnamespace std;
void Nums(vector<int>&values)
{
int i= -1;
string temp;
do
{
i++;
values.resize(i+1);
cout << "Please enter a number <ENTER to quit>: ";
getline(cin, temp);
values[i] = atoi (temp.c_str());
} while (temp != "");
}
void ShowNums(vector <int> values)
{
//Need to add a mean, median, & mode
}
void Swap (int & first, int & second)
{
string temp = first;
first = second;
second = temp;
}
void SortNums (vector<int>values)
{
for (int i=0; i<values.size(); i++)
for (int j=0; j<values.size(); j++)
if (values[j]) < (values[j+1])
Swap(values[j], values[j+1]);
}
void main()
{
vector <int> values;
GetNums(values);
cout << endl;
SortNums(values);
cout << endl;
ShowNums(values);
cout << endl;
}
Syntax Errors:
1 2 3 4 5 6 7 8 9 10 11
Compiling...
Project.001.cpp
c:\documents and settings\two\desktop\project.001.cpp(31) : error C2440: 'initializing' : cannot convert from 'int' to 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
No constructor could take the source type, or constructor overload resolution was ambiguous
c:\documents and settings\two\desktop\project.001.cpp(33) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is
no acceptable conversion)
c:\documents and settings\two\desktop\project.001.cpp(41) : error C2143: syntax error : missing ';' before '<'
c:\documents and settings\two\desktop\project.001.cpp(49) : error C2065: 'GetNums' : undeclared identifier
Error executing cl.exe.
Project.001.obj - 4 error(s), 0 warning(s)