error

hello guys i have a problem, what does this error mean?
http://www.freeuploadsite.com/do.php?img=53721
i dont know how to fix it
You are doing something like:

1
2
3
4
5
6
#include <string>

int main()
{
    std::string str(NULL);
}
It would appear that you attempted to construct a string, and somehow failed. Could we see snippets of the code that deal with strings?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
int Menu::buyingMenu(int price_func=0, string details_func=" ", string item_func=" ",bool equipment_func=true,int gold_func=0)
{
    cout<<"[1]Buy [2]Sell [3]Details [4]Back"<<endl;
    choose=_getch();
    switch(choose)
    {
     case '1':
        cout<<"You need "<<price_func<< " Gold.\nAre you sure you want to buy this?\n[1]Yes [2]No";
        choose=_getch();
     if ( choose == '1' )//cout<<"[1]Battle suit = 950 Gold\n[2]Cuirass  2400 Gold\n[3]Maximillian 5400 Gold"<<endl;
     {
           if(  gold_func >= price_func  )
           {
                gold_func -= price_func;
                equipment_func = true;
               cout<<"You have successfully bought "<<item_func<<endl;
           }
           else
          cout<<"You don't have enough money to buy "<<item_func<<endl;
     }
     else
        buyingMenu();
     case '2':
         if(item_func!=" ")
         {
             cout<<"Are you sure you want to sell "<<item_func<<"? [1]Yes [2]No"<<endl;
             choose=_getch();
             if(choose== '1')
             {
                 gold += price_func;
                 equipment_func=false;
                 cout<<"You have successfully sold your "<<item_func<<endl;
                 cout<<"Press any key to return";
                 choose=_getch();
                 armorShop();
             }
             else
                 buyingMenu();
         }
         else
         {
             cout<<"You don't have this weapon yet"<<endl;
             cout<<"Press any key to return"<<endl;
             choose=_getch();
             buyingMenu();
         }
         break;
         case '3':
             cout<<details_func<<endl;
             cout<<"Press any key to return"<<endl;
             choose=_getch();
             buyingMenu();
             break;
    default:
        buyingMenu(); break;
    }
    return gold_func;
}
1
2
3
4
5
6
7
8
void Menu::items(string item_func=" ",bool equipment_func=true)
{
        item_func=" Item function ";
    if(  equipment_func == true  )
        item_func;
        else
        item_func=" ";
}


and this
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
void Menu::armorShop()
{
    system("cls");
cout<<"[1]Battle suit = 950 Gold\n[2]Cuirass  2400 Gold\n[3]Maximillian 5400 Gold"<<endl;
choose=_getch();
switch(choose)
{
case '1':
    {shop battleSuit;
    battleSuit.price=950;
    battleSuit.details="This will give you additional 5 armor when worn. Good for newbies.";
 buyingMenu(battleSuit.price,battleSuit.details,battleSuit.item,battleSuit.equipment,gold);
 battleSuit.item="Battle Suit";
 items(battleSuit.item,battleSuit.equipment);}
 break;
case '2':
    {shop cuirass;
    cuirass.price=2400;
    cuirass.details="This will give you additional 7 armor when worn.";
    buyingMenu(cuirass.price,cuirass.details,cuirass.item,cuirass.equipment,gold);
    cuirass.item="Cuirass";
    items(cuirass.item,cuirass.equipment);}
break;
case '3':
    {shop Maximillian;
 Maximillian.price=5400;
 Maximillian.details="This will give you additional 9 armor when worn ";
buyingMenu(Maximillian.price,Maximillian.details,Maximillian.item,Maximillian.equipment,gold);
Maximillian.item="Maximillian";
items(Maximillian.item,Maximillian.equipment);}
break;
default:
    armorShop();   break;
}
}

as well as the weapon shop
Last edited on
@Ispil what do i do now ?
Do you have any functions that return strings? If so, make sure they don't return 0- it could likely be the source of this, seeing as how your code deals with quite a few strings.
@Ispil
1
2
3
4
5
6
string Menu::msgForLosing(string msg_for_losing_func)
{
        string message_for_losing=" ";
  msg_for_losing_func = "\nYou lose!\nYou do not have obtain anything\n";
  return msg_for_losing_func;
}

this is the only function that returns string.
@Ispil
this is the whole code
http://codeviewer.org/view/code:444b
Topic archived. No new replies allowed.