#include <iostream>
int main()
{
int cnt = 0, sum = 0, value = 0;
std::cout << "Please enter a set of numbers and then press ctrl+z and ENTER to add the numbers that you entered" << std::endl;
if (cnt = value)
++cnt;
while (std::cin >> value)
sum += value;
std::cout << "the sum is: " << sum << std::endl;
std::cout << "the amount of numbers you entered are: " << cnt << std::endl;
return 0;
}
The if statement that I have is wrong and does not count the amount of integers the user enters into value.
How can I make the program count the amount of integers the user enters using a loop?