コード例 #1
0
ファイル: main.cpp プロジェクト: akosgarai/grafika
 //put a new stuff to the bag or rase the amount if the stuff isn't new
 void addStuff(Stuff s) {
     if(stuffNum < bagcapacity) {
         for(int i = 0; i < stuffNum; i++) {
             if(this->myStuffs[i].getName() == s.getName()) {
                 this->myStuffs[i].add(s.getAmount());
                 return;
             }
         }
         myStuffs[stuffNum] = s;
         stuffNum++;
         cout << "Your found your " << stuffNum <<". stuff: " << this->myStuffs[stuffNum-1].getName() << "\n";
     } else {
         cout << "Sorry, but you are full. You should drop something.\n";
     }
 }