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
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: "<
// 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"< 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started