hi there ! im new here and i wish to stick around for a good while !!


and would like to ask you !

can u help me with this (i need this code to change a bit ! but still work in same way!! (im using c++)

plz anyone !!

#include <iostream.h>
#include <cstring.h>
string user();
string call_type();
int insert_coin();
float time(float y,string z);
 
int main()
{
string login;
int coin_total = 0;
float time_total;
string type;
int call1;
login = user();
if (login == "error")
{
cout << "\n\t\t\tPin tries exceeded,\n\t\tPlease consult your supervisor";
return 0;
}
else
cout << "\n\t\t\tWelcome " << login;
type = call_type();
coin_total = insert_coin();
cout << "\n\n" << coin_total;
time_total = time(coin_total,type);
cout << "\n\n\n" << login << " you have " << time_total << " for your " << type << " call";
return 0;
}
string user()
{
string n1("mary");
string n2("gerry");
string n3("sue");
string n4("jim");
string n5("clare");
string namex[5] = {n1,n2,n3,n4,n5};
string name;
int pinx[5] = {2000,3000,4000,5000,6000};
int pin;
int counter = 0;
int counter2 = 0;
string n6("error");
do
{
cout << "Please enter your name : ";
cin >> name;
cout << "Please enter your pin number : ";
cin >> pin;
while (counter <= 4)
{
if(name == namex[counter]&&pin == pinx[counter])
{
return name;
}
else
{
counter++;
}
}
if (counter2 >= 2)
{
return n6;
}
counter2++;
}while (name != namex[counter]||pin != pinx[counter]);
 
 
}
string call_type()
{
char ctype;
string c1("local");
string c2("trunk");
string c3("international");
cout << "\n";
cout << "\n\tLocal calls(L/l): 20 seconds for every 10c";
cout << "\n\tTrunk calls(T/t): 10 seconds for every 10c";
cout << "\n\tInternational calls(I/i): 5 seconds for every 10c";
while (ctype != 'l'&&ctype != 'L'&&ctype != 't'&&ctype != 'T'&&ctype != 'i'&&ctype != 'I')
{
cout << "\n\n\tPlease enter call type : ";
cin >> ctype;
 
}
if (ctype == 'l'||ctype == 'L')
return c1;
if (ctype == 't'||ctype == 'T')
return c2;
if (ctype == 'i'||ctype == 'I')
return c3;
}
int insert_coin()
{
float coin;
int duration;
float total = 0;
cout << "\n\tThis machine only takes 5,10,20 or 50 cent coins";
cout << "\n\t\tAny other coins will be returned";
while (coin != 0)
{
cout << "\n\n\t\tInsert Coins : ";
cin >> coin;
 
if (coin != 0&&coin != 5&&coin != 10&&coin != 20&& coin != 50)
{
cout << "refund : " <<coin;
total = total - coin;
}
else (coin == 5||coin == 10||coin == 20||coin == 50) ;
{
total = total + coin;
}
cout << "\t\tThe total is :" << total;
}
return total;
}
float time(float y,string z)
{
float total_time;
 
if (z == "local"||z == "trunk"||z == "international")
{
if (z == "local")
{
total_time = ((y/10)*20)/60;
}
if (z == "trunk")
{
total_time = (y/60);
}
if (z == "international")
{
total_time = ((y/10)*5)/60;
}
}
return total_time;
 
}

:( :'(


I have this as an important Assignment to do by 20/04/07!!!!!! pz help me out

>>pz help me out
Sure, if you tell us what's wrong with the code you posted (other than being horribly formatted)

>>pz help me out
Sure, if you tell us what's wrong with the code you posted (other than being horribly formatted)

well there is nothing wrong eith this code but my friend have helped me out with this code so he said to me try to change it as much as possible so before our final essignment have to be handed in we sepost too have two diffrent ones \:(

Oh I see -- you want us to help you steal someone else's code. Not. :@

Oh I see -- you want us to help you steal someone else's code. Not. :@

no i dont !!

:|
if u dont want to help the n its fine !! (and i dont steal i used to beregistered on this website last year and i was making my own c++ and IM NOT a liar !! :(

Member Avatar for iamthwee

Learn to do your own homework next time.

no i dont !!

:|
if u dont want to help the n its fine !! (and i dont steal i used to beregistered on this website last year and i was making my own c++ and IM NOT a liar !! :(

Sorry, I didn't say you were lying -- I believed you when you said you were trying to cheat. :(

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.