Question: Please use this C++ code to create a flowchart. Thank you. #include using namespace std; int main() { // declaring variables int ones,fives,tens,twenties,fifties,hundreds,salesCnt,openingBal,salesAmt,deposit=0,paidAmt,i=1,diff; // prompting

Please use this C++ code to create a flowchart. Thank you.

#include using namespace std;

int main() { // declaring variables int ones,fives,tens,twenties,fifties,hundreds,salesCnt,openingBal,salesAmt,deposit=0,paidAmt,i=1,diff; // prompting and taking values for denominations cout<<"Enter 1\'s in opening cash: "<>ones; cout<<"Enter 5\'s in opening cash: "<>fives; cout<<"Enter 10s in opening cash: "<>tens; cout<<"Enter 20\'s in opening cash: "<>twenties; cout<<"Enter 50\'s in opening cash: "<>fifties; cout<<"Enter 100\'s in opening cash: "<>hundreds;

// calculating open balance openingBal=ones+fives+tens+twenties+fifties+hundreds; // calculatoin deposit deposit=deposit+openingBal;

// random value generator salesCnt=rand()%20+1;

// looping through obtained count while ( i <=salesCnt) { // reading current sales amount cout<<"Enter the amount sales "<>salesAmt;

// checking errors in sales amount if (salesAmt<0) cout<<"Amount is lessthan 0"<

else if (salesAmt>100) cout<<"Amount is greater than 100"<

else { // reaidng paid amount cout<<"Enter the amount paid: "; cin>>paidAmt; // handling errors while taking input if( paidAmt<0) cout<<"Amount is lessthan 0"<100) cout<<"Amount is greater than 100"<

else {

// calculating difference to be given to customner diff=paidAmt-salesAmt; //adjusting the cash in the cash drawer if(diff>0) { if(diff==1) ones-=1; else if(diff==5) fives-=1; else if(diff==1) tens-=1; else if(diff==20) twenties-=1; else if (diff==50) fifties-=1; else if (diff==100) hundreds-=1; }

// updating cashdrawer with amount given by the user if (paidAmt==1) ones+=1;

else if (paidAmt==5) fives+=1;

else if (paidAmt==10)

tens+=1;

else if (paidAmt==20)

twenties+=1;

else if (paidAmt==50) fifties+=1;

else if (paidAmt==100) hundreds+=1;

deposit+=diff;

i=i+1; }

} }

// calculating deposit amount cout<

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!