help me!!!!

i'm trying to do this coding but i don't know how to change it based on the error statement that had been told to me. can someone please correct me?
here is my code


#include<iostream>
#include<fstream>
#include<cstdio>
using namespace std;

void A1();
void B1();
void C1();
void D1();
void E();
void ticket();
void Deposit();
void Full();
void Status();

//variable

char answer;
char pilihan;
char sukan;
int no, ticketno,cara;
int acc;
int Jumlah,baki;
double jumlah;
int booking_id=100;
int n;
int i;
int j;

int main()
{



cout<<" SELAMAT DATANG "<<endl;
cout<<" KE "<<endl;
cout<<" PUSAT SUKAN PARIT RAJA "<<endl;


cout<<" A - BOLA SEPAK "<<endl;
cout<<" B - SEPAK TAKRAW "<<endl;
cout<<" C - BADMINTON "<<endl;
cout<<" D - BOLA JARING "<<endl;
cout<<" E - STATUS PEMBAYARAN "<<endl;
cout<<" SILA PILIH SUKAN PILIHAN ANDA :"<< answer <<endl;

if( answer=='A')

A1();

else if( answer=='B')

B1();

else if( answer=='C')

C1();

else if( answer=='D')

D1();

else

E();

return 0;

}

void A1()
{



cout<<" TARIKH PERLAWANAN MASA TEMPAT "<<endl;

cout<<" 1. 24 JUN 2012 UTHM vs PENDUDUK PARIT RAJA 9.00 AM STADIUM UTHM "<<endl;

cout<<" 2. 2 JULAI 2012 PENDUDUK PARIT RAJA vs SMK SRI GADING 9.00 AM SMK SRI GADING "<<endl;

cout<<" 3. 17 JULAI 2012 KKTM vs PENDUDUK PARIT RAJA 9.00 AM KKTM "<<endl;

cout<<" 4. 25 NOV 2012 PENDUDUK PARIT RAJA vs JOHOR FC 9.00 AM STADIUM UTHM "<<endl;

cout<<" INGIN MEMBUAT TEMPAHAN TIKET? "<<endl;

cout<<" 1 - YA "<<endl;
cout<<" 2 - TIDAK "<<endl;
cout<<" SILA MASUKKAN PILIHAN ANDA: "<< pilihan <<endl;

if(pilihan==1)

ticket();

else

cout<<" TERIMA KASIH. JUMPA LAGI. "<<endl;
}

void B1()
{



cout<<" TARIKH PERLAWANAN MASA TEMPAT "<<endl;

cout<<" 1. 2 OKTOBER 2012 UTHM vs PENDUDUK PARIT RAJA 8.00 PM KKTM "<<endl;

cout<<" 2. 14 OKTOBER 2012 PENDUDUK PARIT RAJA vs SMK SRI GADING 8.00 PM SMK SRI GADING "<<endl;

cout<<" 3. 5 NOV 2012 KKTM vs PENDUDUK PARIT RAJA 8.00 PM STADIUM UTHM "<<endl;

cout<<" 4. 12 DIS 2012 PENDUDUK PARIT RAJA vs PEMUDA UMNO 8.00 PM STADIUM UTHM "<<endl;


cout<<" INGIN MEMBUAT TEMPAHAN TIKET? "<<endl;

cout<<" 1 - YA "<<endl;
cout<<" 2 - TIDAK "<<endl;

cout<<" SILA MASUKKAN PILIHAN ANDA: "<< pilihan <<endl;

if(pilihan==1)

ticket();

else

cout<<" TERIMA KASIH. JUMPA LAGI. "<<endl;
}

void C1()
{



cout<<" TARIKH PERLAWANAN MASA TEMPAT "<<endl;

cout<<" 1. 1 OGOS 2012 UTHM vs PENDUDUK PARIT RAJA 8.00 PM KKTM "<<endl;

cout<<" 2. 16 OGOS 2012 PENDUDUK PARIT RAJA vs SMK SRI GADING 8.00 PM SMK SRI GADING "<<endl;

cout<<" 3. 1 SEP 2012 KKTM vs PENDUDUK PARIT RAJA 8.00 PM GELANGGANG UTHM "<<endl;

cout<<" 4. 26 SEP 2012 PENDUDUK PARIT RAJA vs PUTERA UMNO 8.00 PM GELANGGANG UTHM "<<endl;


cout<<" INGIN MEMBUAT TEMPAHAN TIKET? "<<endl;

cout<<" 1 - YA "<<endl;
cout<<" 2 - TIDAK "<<endl;

cout<<" SILA MASUKKAN PILIHAN ANDA: "<< pilihan <<endl;

if(pilihan==1)

ticket();

else

cout<<" TERIMA KASIH. JUMPA LAGI. "<<endl;
}

void D1()
{



cout<<" TARIKH PERLAWANAN MASA TEMPAT "<<endl;

cout<<" 1. 20 MAC 2012 UTHM vs PENDUDUK PARIT RAJA 9.00 AM KKTM "<<endl;

cout<<" 2. 24 MAC 2012 PENDUDUK PARIT RAJA vs SMK SRI GADING 9.00 AM SMK SRI GADING "<<endl;

cout<<" 3. 30 MEI 2012 KKTM vs PENDUDUK PARIT RAJA 9.00 AM STADIUM UTHM "<<endl;

cout<<" 4. 4 JUN 2012 PENDUDUK PARIT RAJA vs PUTERI UMNO 9.00 AM STADIUM UTHM "<<endl;

cout<<" INGIN MEMBUAT TEMPAHAN TIKET? "<<endl;

cout<<" 1 - YA "<<endl;
cout<<" 2 - TIDAK "<<endl;

cout<<" SILA MASUKKAN PILIHAN ANDA: "<< pilihan <<endl;

if(pilihan==1)

ticket();

else

cout<<" TERIMA KASIH. JUMPA LAGI. "<<endl;
}

void ticket()
{



cout<<" Jenis sukan : " << sukan <<endl;
cout<<" Perlawanan : " << no <<endl;
cout<<" Bilangan tiket : " << ticketno <<endl;

Jumlah = ticketno*10;

cout<<" Jumlah Pembayaran : RM " << Jumlah <<endl;
cout<<" Cara Bayaran : " <<endl;
cout<<" Deposit - 1 Penuh - 2 " <<endl;

if ( cara==1)

Deposit();

else
Full();

}

void Full()
{

cout<< "Jumlah yang perlu dibayar:";
gets(Jumlah);
cout<< "Masukkan nombor akaun anda:" << acc <<endl;
cout<<"Pembayaran telah dibuat. Terima kasih kerana menggunakan perkhidmatan kami."<<endl;


}

void Deposit()
{


ofstream deposit;
deposit.open("customer.txt",ios::out);


cout<<"Pembayaran deposit mestilah melebihi RM5."<<endl;
cout<<"Jumlah yang perlu dibayar:";
gets(Jumlah);
cout<<"Jumlah yang ingin dibayar:"<<jumlah<<endl;
deposit<<jumlah;
cout<<"Sila masukkan nombor akaun:"<< acc <<endl;
deposit<<acc;

baki=Jumlah-jumlah;

cout<<"Pembayaran telah dibuat. Baki pembayaran ialah: RM"<< baki <<endl;
deposit<<baki;

cout<<" ID anda ialah:";

booking_id++;

deposit.close();


}

void E()
{

fstream deposit;
deposit.open("customer.txt",ios::in|ios::out|ios::app)

;cout<<"Sila masukkan ID anda:";

gets (booking_id);

deposit>>acc;

cout<< acc <<endl;

deposit>>jumlah;

cout<< jumlah <<endl;

deposit>>baki;

cout<< baki <<endl;

cout<<"Ingin membuat pembayaran selebihnya?"<<endl;

cout<<" Ya - 1 Tidak - 2 "<<endl;

if(n==1)

Status();

else

cout<<" Terima kasih kerana menggunakan perkhidmatan kami."<<endl;

return;

}

void Status()
{

cout<<"Baki pembayaran anda ialah:";

gets(baki);

cout<<"Sila tekan nombor satu sekiranya anda ingin membuat pembayaran baki."<<endl;

cin>>no;

if(no==1)

cout<<"Pembayaran baki telah dibuat. Terima kasih."<<endl;

return;

else

cout<<"Terima kasih kerana menggunakan perkhidmatan kami."<<endl;

return;
}


here is the error statement

--------------------Configuration: gfjygtf - Win32 Debug--------------------
Compiling...
hjvktgc.cpp
C:\bec10103\gfjygtf\hjvktgc.cpp(224) : error C2664: 'gets' : cannot convert parameter 1 from 'int' to 'char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\bec10103\gfjygtf\hjvktgc.cpp(241) : error C2664: 'gets' : cannot convert parameter 1 from 'int' to 'char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\bec10103\gfjygtf\hjvktgc.cpp(269) : error C2664: 'gets' : cannot convert parameter 1 from 'int' to 'char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\bec10103\gfjygtf\hjvktgc.cpp(304) : error C2664: 'gets' : cannot convert parameter 1 from 'int' to 'char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
C:\bec10103\gfjygtf\hjvktgc.cpp(316) : error C2181: illegal else without matching if
Error executing cl.exe.

hjvktgc.obj - 5 error(s), 0 warning(s)




Please use code blocks.

Your error is this gets (booking_id);

gets takes a char or string and booking_id is an integer. Where are even declaring gets( ) anyway?
ok....but can you explain what is code blocks?? do gets need to declare???
Codeblocks are the button on the side that look like <>
Place you code in the tags.

I think gets takes a char or string and you are passing in an int and double to it. I couldn't find the declaration for it so I don't know.

Last edited on
tq for that information really appreciate it....
Topic archived. No new replies allowed.