Hi, guys! First post here.
I'm doing this project for the hell of it and I am improvising a lot of stuff to accommodate what would REALLY happen in most cases.
So, this calculates mileage. Everything is fine until the bottom with the Do/While loops. I don't know the best way to do Y/N situations. Could I call on you to educate me on why these Do/While loops are not placed correctly? Thanks in advance!
EDIT: I'm adding in the way I coded the heading variables just for verification.
Code:double start_mile, end_mile; double reimbursement = .35; char mile_yn; /* Mile Yes/No for Below */ char reim_yn /* Reimbursement Loop Killer */Code:int mile_calc() { /* You Show Off */ printf("\nMile Reimbursement Calculator"); printf("\nVersion 1.0.001"); /* Starting Mileage */ printf("Please Enter Your Mileage Before Trip: "); scanf("%.1f", &start_mile); /* Ending Mileage */ printf("Please Enter Your Mileage After Trip: "); scanf("%.1f", &end_mile); /* Ask If Reimbursement Needs to be Adjusted */ do { printf("Current Reimbursement: ", reimbursement); printf("\nIs this correct(Y/N)?"); scanf("%c", &mile_yn); if (mile_yn = "Y") printf("Calculating...\n"); if (mile_yn = "N") printf("Enter the New Reimbursement Rate: "); scanf("%.2f", reimbursement); printf("New Reimbursement: ", reimbursement); printf("\nIs this correct(Y/N)?"); if (mile_yn = "y") printf("Calculating...\n"); if (mile_yn = "n") printf("Enter the New Reimbursement Rate: "); scanf("%.2f", reimbursement); printf("New Reimbursement: ", reimbursement); printf("\nIs this correct(Y/N)?"); scanf("%c", &reim_yn); } while ( reim_yn ("N")); }



LinkBack URL
About LinkBacks




