Hello there my fellow programmers.Since I fell in love with this forum and the users,I came to ask yet another question,if you can spare 5 minutes to look at it.
#include<iostream>
#include<string>
usingnamespace std;
int main()
{
constint MAX_ITEMS = 10;
string inventory[MAX_ITEMS]; // you can only carry 10 items.
int number_items = 0;
inventory[number_items++] = "sword";
inventory[number_items++] = "shield";
inventory[number_items++] = "armor";
// by this time,the number of item is 3,I believe.
cout << "your items:" << endl;
for (int i = 0;i < number_items;++i)
{
cout << inventory[i] << endl;
} // prints out all the items in inventory
system("pause");
return 0;
}
If anyone has read Micheal Dawson's 'beginning C++ with game programming',that is where I got it from.Anyways,
the problem with this is that I believe there is no problem with the actually code,but the cmd itself.When I try to run the program,the cmd opens in a blank,and suddenly the error window appears that says 'the *insert file name here* stopped working.'That is really funny because it doesnt create such error with other programs.If anyone knows how to deal with this,please let me know.