jeudi 13 août 2015

C++ Crash (Compiler?)

I have a very simple program I'm starting up, but when I try to run it, it gets to "has an initial population of" then crashes every time. For context, I am using visual studio 2015 on windows 10.

#include <iostream>
#include <cmath>
#include <string>
using namespace std;

/*Ideas for features to add
*----------------------------
*Trade, agriculture, traffic, tourism, housing, crime rate, language, religion
*/

string version = "1.0";
void main() {
    cout << "Welcome to Population Simulator v" + version + ".\n";
    cout << "In this game we will simulate a city and how the population numbers change over time.\n";
    //City initialization 
    cout << "Please input a name for your city: ";
    string name;
    cin >> name;
    cout << "Please input an initial population of the city (Recommended: 10,000): ";
    int population = 0;
    cin >> population;
    int initialPopulation = population;
    int initialWealth = population * 10000;
    int wealth = initialWealth;
    int year = 2000;
    cout << name + " has an initial population of ";
    cout << population + " and an initial net-worth of $" + wealth;
    cout << ".\n";


}
int weather() {
    return 0;
}
int NPG() { //natural population growth
    return 0;
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire