0

Im creating a C++ program to rob the player's money. But when i run it. It just exiting the console. How do i fix this?

#include <iostream>
#include <cstdlib>
#include <ctime>
#include <windows.h>
    
int rob,money,chance;
void rob()
{
    rob = money / 20;
    money-=money;
    cout<<"U get robbed by"<<rob<<endl;
    srand(time(0));
    chance = rand() % 2+1;
    if(chance==1)
    {
        rob();
    }
    if(chance==2)
    {
        cout<<"You not getting robbed!"
        system("pause");
    }
}
int main()
{
    rob();
}

0 Answers0