Pls Need Immediate Help

i have a problem in having returning a function. my problem is if i press Y then its need only to return in a cout that is to enter an account but it turns to return the whole cout including the customer type. so i only need to return to Enter an Account cout<< if i just going to enter Y or yes. Please help

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

using namespace std;
void Acc();
int main()
{
cout<<"\t\t\b\t\t CABLE BILLING PROGRAM\n";
cout<<"\n\t\t----------------------------------------\n";


getch();
Acc();
return 0;
}
void Acc()
{

int pcs;
int pc;
float bpf = 14.50;
float bsc = 150.75;
float pcc = 67.35;
float resBILL ;
int bsconnect;
float bbpf = 35.00;
float bbsc = 215.45;
float bpcc = 87.75;
float bbcc = 10.00;
resBILL = 0;
char name[10];
char choice;
string restart;
{ start:
cout<<"\n\t\tEnter Account Name:";
cin.getline(name,9);
system("PAUSE");
}
{
cout<<"\n\t\tR,r(Residential) and B,b(Business)\n";
cout<<"\t\tEnter Costumer Type:";
cin>>choice;
}

switch(choice)
{
case 'B':
case 'b':
cout<<"\t\t----------------------------------------\n";
cout<<"\t\tEnter the number of basic service connections:";
cin>>bsconnect;
cout<<"\n\t\tEnter the number of premium channels used:";



cin>>pcs;

if (bsconnect <=10)
{
resBILL = pcs * bpcc + bbpf + bbsc;
cout<<"\t\t----------------------------------------\n";
cout<<"\t\t"<<name<<" your computer billing amount is:"<<resBILL;
cout<<"\n\t\t----------------------------------------\n";
}
else
{
resBILL = bsconnect * bbcc + pcs * bpcc + bbpf + bbsc;
cout<<"\t\t----------------------------------------\n";
cout<<"\t\t"<<name<<" your computer billing amount is:"<<resBILL;
cout<<"\n\t\t----------------------------------------\n";
}
cout << "\t\tDo you want to continue? - Y/N ";
cin >> restart;
cout<<"\n\t\t----------------------------------------\n";

if ( restart == "Yes" || restart == "yes" || restart == "y" || restart == "Y")
{
return Acc();
}
else if ( restart == "No" || restart == "no" || restart =="n" || restart == "N")
cout<<"\t\tProgram Terminated!";

break;




case 'R':
case 'r':
cout<<"\t\t----------------------------------------\n";
cout<<"\t\tEnter the number of premium channels used:";
cin>>pc;
cout<<"\n\t\t----------------------------------------\n";


resBILL = (pc * pcc)+bpf+bsc;

cout<<"\t\t"<<name<<" your computer billing amount is:"<<resBILL;
cout<<"\n\t\t----------------------------------------\n";
cout << "\t\tDo you want to continue? - Y/N ";
cin >> restart;
cout<<"\n\t\t----------------------------------------\n";

if ( restart == "Yes" || restart == "yes" || restart == "y" || restart == "Y")
{
return Acc();
}
else if ( restart == "No" || restart == "no" || restart =="n" || restart == "N")
cout<<"\t\tProgram Terminated!";
break;



}





system("PAUSE");

}



any help?
Your problem is your return statement in Acc().
 
return Acc();

You're calling Acc recursively.

To return from a void function, simply return.
 
return;


PLEASE USE CODE TAGS (the <> formatting button) when posting code.



Topic archived. No new replies allowed.