So here is the assignment speculation:
Write a program that reads in a list of integers. This list may contain positive or negative integers and be any size, determined by the user of the program. The user should signal they are done entering values by entering the character q instead of an integer. When the user is done entering integer values, the program should output a two-column list. The first column is a list of the distinct vector elements; the second column is the count of the number of occurrences of each element. The list should be sorted on enteries in the first column, largest to smallest.
If the user enters the following values:
-12 3 -12 4 1 1 -12 1 -1 1 2 3 4 2 3 -12
the output should be:
N Count
4 2
3 3
2 2
1 4
-1 1
-12 4
Code:
#include <iostream>
#include <vector>
using namespace std;
/**
*/
int main()
{
vector<double> integers;
cout << "Please enter integers. Enter q to see result.\n";
bool more = true;
while (more)
{
int value;
cin >> value;
if (value == )
more = false;
else
integers.push_back(value);
}
int i;
for (i = 1; i < integers.push_back(value); i++)
{
}
return 0;
}
And this is what I got so far but I'm stuck on if (value == ) because I have no idea how to make the user to input the character instead of an integer in order to quit by entering "q" as stated above in cout. Anyone??