Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
excusme, please help me. i can't run my program because one mistake "statement missing;"
C++
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <iomanip.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <windows.h>
garis(){
printf("	|===========|=================|===============| ");}//coding yang akan terpanggil

//program utama
int main(){
char jawab,cust[50],code,hair[50],tipe2[50],tipe,ketikya,bonus[30];
float pembayaran,harga,pot,ppn,total,u_byr,u_kmb, beli,tot_bayar,diskon,jum_bayar;
{
class Simulator{
 public :
  Simulator();
  int ambil_jam();
  int proses();

 private :
  int jam, menit, detik;
};

Simulator::Simulator(){
}

int Simulator::ambil_jam(){
 //deklarasi objek yang memanfaatkan class dan struct yang ada di library time.h
    time_t rawtime;
 tm * timeinfo;
 //proses pengambilan data waktu sistem
    time ( &rawtime );
 timeinfo = localtime ( &rawtime );

 //proses pemindahan data waktu sesuai dengan format ke dalam variabel
    jam=timeinfo->tm_hour;     //format untuk jam
    menit=timeinfo->tm_min;    //format untuk menit
    detik=timeinfo->tm_sec;    //format untuk detik
}

int Simulator::proses(){
 while (true){
 clrscr();
  cout<<"==========================================\n";
  cout<<"||\t\t\t\t\t||\n";
  cout<<"||\t\tJAM DIGITAL\t\t\ ||\n";
  cout<<"||\t\t  ";
  cout<<jam<<":"<<menit<<":"<<detik;
  cout<<"\t\t||\n";
  cout<<"||\t\t\t\t\t||\n==========================================\n\n";
  Sleep(1000);
  detik=detik+1;
  if (detik>59){
   detik=0;
   menit=menit+1;
   if(menit>59){
    menit=0;
    jam=jam+1;
    if(jam>23){
     jam=0;

    } 
 }
  }
  }
 
}

int main(int argc, char *argv[]) {
 Simulator digital;
 digital.ambil_jam();
 digital.proses();
 
 return 0;
}
cout<<"  \n\n***********************************************************************"<<endl;
cout<<"------------------------------KELOMPOK SALON---------------------------\n\n"<<endl;
garis();//memanggil fungsi garis
cout<<"\n 	  No. Absen    NAMA KELOMPOK         NIM"<<endl;
garis();//memanggil fungsi garis
cout<<"\n	     	      	    "<<endl;
garis();
cout<<"\n             47       FRISKA               "<<endl;
garis()
cout<<"\n             55       YOLANDA      "<<endl;
garis();
cout<<"\n             12       ALZENA      "<<endl;
garis();
cout<<"\n\n KETIK 'Y' UNTUK MELIHAT PROGRAM : ";cin>>ketikya;
if(ketikya=='Y'||ketikya=='y')
goto salon;
    salon:
    clrscr();
    cout<<"\n\n SILAHKAN PILIH 1 UNTUK MENAMPILKAN LIST DAN PEMBAYARAN "<<endl;
    cout<<"\n\n\n\n        |******************************************|\n";//tampilan awal program salon
    cout<<"        |==========================================|\n";
    cout<<"        |     1. LIST PERAWATAN                    |\n";
	 cout<<"        |==========================================|\n"<<endl;
    cout<<"  KETIK 1 UNTUK MENAMPILKAN LIST DAN PEMBAYARAN : ";cin>>jawab;
    if (jawab=='1'||jawab=='1')
    goto list;
    else if (jawab=='2'||jawab=='2')
    goto pembayaran;
    else if (jawab=='3'||jawab=='3')
    goto end;
    else{
    	clrscr();
      cout<<" INPUTAN YANG ANDA MASUKKAN SALAH SILAHKAN PILIH 1/2/3 ";
    getch();
    goto salon;
    }

    list:
    clrscr();
    cout<<"      |========================================================|\n";
    cout<<"      |                    LIST PERAWATAN                      |\n";
    cout<<"      |========================================================|\n";
    cout<<"      |   HAIR TREATMENT     |   TIPE    |      HARGA          |\n";
    cout<<"      |----------------------|-----------|---------------------|\n";
    cout<<"      | 1.Gunting Rambut     |  Stylish  |    Rp. 15.000,-     |\n";
    cout<<"      |                      |  Reguler  |    Rp. 10.000,-     |\n";
    cout<<"      | 2.Cuci + Blow        |  Stylish  |    Rp. 20.000,-     |\n";
    cout<<"      |                      |  Reguler  |    Rp. 15.000,-     |\n";
    cout<<"      | 3.Creambath          |   Buah    |    Rp. 35.000,-     |\n";
    cout<<"      |                      |  Matrix   |    Rp. 60.000,-     |\n";
    cout<<"      | 4.Hair Spa           |  Makarizo |    Rp. 50.000,-     |\n";
    cout<<"      |                      |  L'oreal  |    Rp. 80.000,-     |\n";
    cout<<"      | 5.Smoothing          |  Panjang  |    Rp. 250.000,-    |\n";
    cout<<"      |                      |  Pendek   |    Rp. 200.000,-    |\n";
    cout<<"      | 6.Toning             |  Panjang  |    Rp. 150.000,-    |\n";
    cout<<"      |                      |  Pendek   |    Rp. 100.000,-    |\n";
    cout<<"      |========================================================|\n";

    cout<<"   TEKAN Y UNTUK PEMBAYARAN : ";cin>>jawab;
    if (jawab=='Y'||jawab=='y')
    goto pembayaran;
    else if (jawab=='T'||jawab=='t')
    goto end;
    else{
    clrscr();
    cout<<" INPUTAN YANG ANDA MASUKKAN SALAH ";
    getch();
    goto list;
    }

    pembayaran:
    clrscr();
    cout<<"      |========================================================|\n";
    cout<<"      |                    LIST PERAWATAN                      |\n";
    cout<<"      |========================================================|\n";
    cout<<"      |   HAIR TREATMENT     |   TIPE    |      HARGA          |\n";
    cout<<"      |----------------------|-----------|---------------------|\n";
    cout<<"      | 1.Gunting Rambut     |  Stylish  |    Rp. 15.000,-     |\n";
    cout<<"      |                      |  Reguler  |    Rp. 10.000,-     |\n";
    cout<<"      | 2.Cuci + Blow        |  Stylish  |    Rp. 20.000,-     |\n";
    cout<<"      |                      |  Reguler  |    Rp. 15.000,-     |\n";
    cout<<"      | 3.Creambath          |   Buah    |    Rp. 35.000,-     |\n";
    cout<<"      |                      |  Matrix   |    Rp. 60.000,-     |\n";
    cout<<"      | 4.Hair Spa           |  Makarizo |    Rp. 50.000,-     |\n";
    cout<<"      |                      |  L'oreal  |    Rp. 80.000,-     |\n";
    cout<<"      | 5.Smoothing          |  Panjang  |    Rp. 250.000,-    |\n";
    cout<<"      |                      |  Pendek   |    Rp. 200.000,-    |\n";
    cout<<"      | 6.Toning             |  Panjang  |    Rp. 150.000,-    |\n";
    cout<<"      |                      |  Pendek   |    Rp. 100.000,-    |\n";
    cout<<"      |========================================================|\n";

    //menggunakan fungsi if
    cout<<"   TEKAN Y UNTUK PEMBAYARAN : ";cin>>jawab;
    if (jawab=='Y'||jawab=='y')
    goto regist;
    else if (jawab=='T'||jawab=='t')
    goto end;
    else{
    clrscr();
    cout<<" INPUTAN YANG ANDA MASUKKAN SALAH ";
    getch();
    goto regist;
    }

    regist:
    clrscr();
    cout<<"\n\n  =========================================================\n";
    cout<<"       Nama Customer              : ";cin>>cust;
    cout<<"       Code Type [1 s/d 6]        : ";cin>>code;
    cout<<"       Tipe Hair Treatment [A/B]  : ";cin>>tipe;
    cout<<"      =========================================================\n";

    if (code=='1')// fungsi if else majemuk
    { strcpy(hair,"Gunting Rambut");

    if (tipe=='A'|| tipe=='a'){
    	strcpy(tipe2,"Anda memilih tipe stylish");
      harga=15000;}
    else if(tipe=='B'|| tipe=='b'){ // fungsi if..else
      strcpy(tipe2,"Anda memilih tipe reguler");
      harga=10000;}
    else{
    	clrscr();
      cout<<" INPUTAN TIPE TIDAK TERDITEKSI ";
      getch();
      goto pembayaran;
      }
      }

      else if(code=='2')
      { strcpy(hair," Cuci + Blow");

      if (tipe=='A'||tipe=='a'){
      	strcpy(tipe2,"Anda memiliki tipe rambut panjang");
         harga=20000;}
      else if(tipe=='B'|| tipe=='b'){
        strcpy(tipe2,"Anda memiliki tipe rambut pendek");
        harga=15000;}
      else{
      	clrscr();
         cout<<" INPUTAN TIPE TIDAK TERDITEKSI ";
         getch();
         goto pembayaran;
         }
         }


    else if(code=='3')
      { strcpy(hair," Creambath ");
    if (tipe=='A'|| tipe=='a'){
    	strcpy(tipe2,"Anda memilih tipe buah");
      harga=35000;}
    else if(tipe=='B'|| tipe=='b'){
        strcpy(tipe2,"Anda memilih tipe matrix");
        harga=60000;}
    else{
    	clrscr();
      cout<<" INPUTAN TIPE TIDAK TERDITEKSI ";
      getch();
      goto pembayaran;
      }
      }

      else if(code=='4')
      { strcpy(hair," Hair Spa ");

      if (tipe=='A'||tipe=='a'){
      	strcpy(tipe2,"Anda memilih tipe makarizo");
         harga=50000;}
      else if(tipe=='B'|| tipe=='b'){
        strcpy(tipe2,"Anda memilih tipe L'oreal");
        harga=80000;}
      else{
      	clrscr();
         cout<<" INPUTAN TIPE TIDAK TERDITEKSI ";
         getch();
         goto pembayaran;
         }
         }

      else if(code=='5')
      { strcpy(hair," Smoothing ");

      if (tipe=='A'||tipe=='a'){
      	strcpy(tipe2,"Anda termasuk tipe rambut panjang");
         harga=250000;}
      else if(tipe=='B'|| tipe=='b'){
        strcpy(tipe2,"Anda termasuk tipe rambut pendek");
        harga=200000;}
      else{
      	clrscr();
         cout<<" INPUTAN TIPE TIDAK TERDITEKSI ";
         getch();
         goto pembayaran;
         }
         }

      else if(code=='6')
      { strcpy(hair," Toning ");

      if (tipe=='A'||tipe=='a'){
      	strcpy(tipe2,"Anda termasuk tipe rambut panjang");
         harga=150000;}
      else if(tipe=='B'|| tipe=='b'){
        strcpy(tipe2,"Anda termasuk tipe rambut pendek");
        harga=100000;}
      else{
      	clrscr();
         cout<<" INPUTAN TIPE TIDAK TERDITEKSI ";
         getch();
         goto pembayaran;
         }
         }
         else{
         clrscr();
         cout<<" INPUTAN KODE SALON TIDAK SESUAI ";
         getch();
         goto pembayaran;
         }

         clrscr();
         cout<<"                       BEAUTY SALON           \n";
   	   cout<<"\n";
    		cout<<"==========================================================\n";
    		cout<<"          Nama Customer       : "<<cust<<"\n";
    		cout<<"          Pilihan List Menu   : "<<hair<<"\n";
    		cout<<"          Tipe                : "<<tipe2<<"\n";
    		cout<<"          Total Bayar         : Rp."<<harga<<"\n";
         cout<<"          Jumlah Perawatan    : ";cin>>beli;
         cout<<"==========================================================\n";


            cout<<"\n";

            pembayaran=harga*beli;

            if(beli>=5)
            pot=0.1*pembayaran;
            else
            pot=0;

            ppn=0.02*pembayaran;
            total=(pembayaran-pot)+ppn;

             cout<<"\n";
    cout<<"          Pembayaran          : Rp."<<pembayaran<<"\n";
    cout<<"          Potongan            : Rp."<<pot<<"\n";
    cout<<"          PPN                 : Rp."<<ppn<<"\n";
    cout<<"          Total Bayar         : Rp."<<total<<"\n";
    cout<<"============================================================\n";

    lagi:
    cout<<"          Uang Bayar          : Rp.";cin>>u_byr;

    if (u_byr<total)

    {goto lagi;
    }
    else

    u_kmb=u_byr-total;

    cout<<"          Uang Kembali        : Rp. "<<u_kmb<<"\n";
    cout<<"          Jumlah yang dibayar : Rp.";cin>>u_byr;
    cout<<"          Pembayaran Rp. ";cin>>tot_bayar;
    if (tot_bayar>=50000){
    diskon=0.1*tot_bayar;
    strcpy(bonus,"Sisir Lipat");}
    else if (tot_bayar>=80000){
    diskon=0.2*tot_bayar;
    strcpy(bonus,"Vitamin Rambut 10 ml");}
    else
    {diskon=0; strcpy(bonus,"Jepit Rambut");}
    cout<<"----------------------------------------------------------"<<endl;
    cout<<"            Selamat kamu mendapat potongan Rp. "<<diskon<<endl;
    jum_bayar=tot_bayar-diskon;
    cout<<"             Kamu hanya perlu membayar Rp. "<<jum_bayar;
    cout<<"\n              Dan Kamu Mendapat Bonus "<<bonus;
    cout<<"\n               TERIMAKASIH ATAS KUNJUNGAN NYA :)  "<<endl;
    cout<<"\n--------------------------------------------------------"<<endl;
    getch();
    }

    cout<<"\n";
    cout<<"\n";
    cout<<"          =====TERIMA KASIH ATAS KUNJUNGAN ANDA=====\n";
    cout<<"\n";
    cout<<"          Input Data Lagi [Y/T] :";
    cin>>jawab;
    if(jawab=='Y'||jawab=='y')
    goto salon ;
    else if(jawab=='T'||jawab=='t')
    goto end;

    end:
return 0;

}

can you help me, please..

[edit]Code block added - OriginalGriff[/edit]

What I have tried:

please help me, without you i can't run my program
Posted
Updated 8-Dec-16 19:43pm
v2
Comments
Peter_in_2780 9-Dec-16 1:44am    
So, find the line the error message references, and add a semicolon in an appropriate place. That may not be the real error, but it should get your program to compile.
CPallini 9-Dec-16 2:48am    
Wow, you are using 'goto' in a C++ program.

1 solution

Couple of things: I'll get to the error you've noticed at the end...
Indentation: it's all over the place, which makes the code hard to read and look very unprofessional.
And when you do indent, pick a bracketing style and be consistent: people won't generally care if you must use 1TB (though I hate it) but if you mix it with K&R and Whitesmiths as well it just makes it even harder to work out where blocks start and end.
Why have you got two main functions?
Goto? Never use goto. Not until you have enough experience to understand why you don't use it unless you really have to - and you don't have the experience and don;t need it for a simple exercise like this. Here it just makes your code even harder to read.
And why the Elephant would anyone write code like this:
C++
    goto end;

    end:
return 0;

Now, the problem you have noticed...
Look at the top of the file:
garis(){
printf("	|===========|=================|===============| ");}//coding yang akan terpanggil
What is that doing there? It's not in a function so it can't be executed...
So the compiler doesn't know what to do with it, and is giving you an error.

But fix the rest as well - that's not going to give you a good grade...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900