You're using rand() wrong. Check the specification of how it's supposed to be used (it doesn't take any arguments). You would probably want to have different random numbers every time too (see srand()).
You should also rather use std::endl instead of '\n' as std::endl is platform independent, while '\n' is Unix-based system specific.
You also don't need to use the exit() statement, you can just let your program leave through the regular code path (leave the loop, leave the main() function).
I've fixed up your code, see it below:
//Car rental system.
//Main objective: set a global variable named "balance" and then assign it to a random value between 60k-500k.
//Cars: BMW, Mercedes, Bugatti, Lamborghini.
//Times: 5 hrs, 10 hrs, 1 day.
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
//Main variable (Ballance)
int ballance;
int randomBalance(int min, int max)
{
int range = max - min;
return min + rand() % range;
}
int main()
{
srand(time(NULL));
int ballance = randomBalance(60000, 500000) + 1;
int answer;
do
{
cout << "Welcome to my car rental system project! (Created in c++)" << endl;
cout << "How can I help you?" << endl;
cout << "1. Show ballance" << endl;
cout << "2. Rent Car" << endl;
cout << "3. Exit." << endl;
cin >> answer;
switch (answer)
{
case 1:
cout << "Your ballance is " << ballance << "!" << endl;
break;
case 2:
//Not yet
break;
case 3:
// Nothing to do here.
break;
}
} while (answer != 3);
return 0;
}