Code:
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int answer = rand;
	int rand;
	cout << "How many gumballs are in the machine.\n";
	do{
		cin >> answer;
		if (answer < rand)
		{ 
			cout << "To low" << endl;
		}
		else if (answer > rand)
		{
			cout << "To high" << endl;
		}
		else
		{
			cout << "Good job now u can eat them.\n";
		}
	}while (answer != rand);
	system("pause");
	return 0;
}
error:
1>c:\users\matthew\desktop\if, else if, else, with do while loop\if, else if, else, with do while loop\gumballs.cpp(6) : error C2440: 'initializing' : cannot convert from 'int (__cdecl *)(void)' to 'int'