#include <stdio.h>
#include <iostream>
#include <conio.h>

#define p printf 
#define s scanf 

float  np, in, ir, pf, ad, md, re, rr,pfl,al;

char bn[20],bc[5],rn[10], c[10];

main()
{
      system("title Application No. 2");
      system("color F4");  
do
{

p("\nEnter your name please:  ");
s("%s", &bn[20]);

p("\nEnter your code (A-C):  ");
s("%s", &bc[5]);

p("\nEnter your Amount Loan:  ");
s("%f", &al);

p("\nEnter your Number of Months to pay:  ");
s("%f", &np);
{
if (bc[5] == 'A')
ir=.07;

else if (bc[5] == 'B')
ir=.05;

else if (bc[5] == 'C')
ir=.03;

else 
p("From A-C only");
}

{if (al <5000)
pf = .02;

else if (al<10001)
pf = .03;

else if (al<20001)
pf = .04;

else 
pf = .05;
}
{if (np <7)
rr= .01;

else if (np <16)
rr= .02;

else if (np <24)
rr= .03;

else
rr = .04;
}

      in = ir * al * np;
      pfl = (pf*al);
      ad = al + in + pfl;
      md = ad / np;
      re = rr * al;
      
system("cls");
p("\n\n\n\t\t\t\t%s", &bn[20]);

{
if (ir == .07)
p("\n\t\t\t\tnNew");

else if (ir == .05)
p("\n\t\t\t\tJunior");

else 
p("\n\t\t\t\tSenior");
}

p("\n\n\tAmount Loan: \t%10.2f", al);

p("\n\tInterest: \t%10.2f", in);

p("\n\tProcessing Fee: %10.2f", pfl);

p("\n\tAmount Due: \t%10.2f", ad);

p("\n\tMonthly Due: \t%10.2f", md);

p("\n\tRebate: \t%10.2f", re);


p("\n\n\n\nTo continue, enter Y, to exit, enter anykey:  ");
s("%s", &c[5]);

system("cls");

p("\t\t\tNew Page");
}
while (c[5] == 'Y' && c[5] =='y');
return 0;



getch();
}

Recommended Answers

All 6 Replies

to make things easier for us....

state the problem...

i use this

To continue, enter Y, to exit, enter anykey:

but I type the "Y" will be exit, not continue...

change this

while (c[5] == 'Y' && c[5] =='y');

to this maybe

while (c[5] == 'Y'|| c[5] =='y');

or to even simplify it more...try this

while (toupper(c[5]) == 'y'); //im not to sure if this will work due to the fact the char is an array... but if this doesnt work try replacing the 5 with a 1... that should actually work better

another thing... why use a char array if your only taking in one char? just do this

char c = 'y';  //which will work with your y/n 
                         //and then the while loop will be better

while(toupper(c) == 'Y'); //this is all that is needed

note: mark as solved if this helps

p("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
p("\n\n\n\t\t\t\t %s", &bn[20]);

{
if (ir == .07)
p("\n\t\t\t\tnNew");
p("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");

else if (ir == .05)
p("\n\t\t\t\tJunior");
p("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
else 
p("\n\t\t\t\tSenior");
p("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
}

if I put this

p("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");

my code will be error

I input Name and etc.. the output always senior?? why not show the NEW and JUNIOR.

Oh my fucking god.

commented: That wasn't very helpful, was it? +0
commented: Worthless...If you're going to post, at least try to help. +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.