Menu
support@nursinghomework.org
+1 714-215-3097

(Solved) : Using C Fix Following Works Following Fill Following String See Work S Loop Errors Problem Q35622189

using c++ fix the following so that it works these are thefollowing you can fill in the following string to see if it workthat s in the do while loop.these are the errors.

the problems is the & in the if statments

heres the header:

#ifndef HEADER1_H
#define HEADER1_H
using namespace std;
#include<string>
#include <algorithm>
#include <stdlib.h>
#include <time.h>
#define NULL “”
#include <iostream>
#include <fstream>
#include <stack>
const int maxs = 5;
class sidepile {
   public:
   int l= 0;
   int overflow = 5;
   int underflow = 0;
   stack<string> mystack;//stack of strings
   string sidedeck(string cardsending);
   string arraysdeck[maxs];
};
string sidepile::sidedeck(string cardsending) {

   arraysdeck[l] += cardsending;
   if (l != 5) {
       mystack.push(cardsending);
   }
    l++;
}//dont know what it means by not the other player

#endif //PCH_H

do {
       if (choice == “y”) {
           cout <<“which would you like to do a add or remove card from side deck: “<< endl;
           cin >>choice;
           if (choice ==”add” && s->mystack.size< s->overflow) {
              s->mystack.push(playertopcard);//pushes topcard to sidepile
              q->playerdeckqueues.pop();//pops off thatcard form players deck
              playertopcard =q->playerdeckqueues.front();//player grabs new card formtop
              cout << “player top card is “<<playertopcard<< endl;
           }
           else if (choice== “remove” && s->mystack.size() > s->underflow){
              player2ndcard = s->mystack.top();//prettysure it pulls card from top of stack
           }

           else {
              if (s->mystack.size > s->overflow){
                  cout << “cant addanymore to your sidedeck” << endl;
              }
              else if(s->mystack.size < s->underflow){
                  cout << “you have nocards to add to your hand ” << endl;
              }
              cout << “do you still want to add orremove something form your sidedeck (y/n): ” << endl;
           }
       }
   } while (choice2 == “y”);// asks player if he want todraw a card if he chooses something he cant do but he want to add acard will lop back;

Leave a Reply

Your email address will not be published. Required fields are marked *