Coding help

Please help me to correct this code.What i want is that i want to display amount of every room and also show the total amount in the end.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#include <iostream>
#include <cstdlib>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
 //////////////////////////////////////***************//////////////////////////
using namespace std ;
struct guest /*to store data of guests*/
{
	char name[30];
	int card ;
	char adress[50];
	
};
main ()
{  int a,b,c,d,e,f,g,h,i,m,n;
    
    guest z[100];
    cout<<endl<<endl<<"                  ******"<<endl<<"                 Welcome"<<endl<<"          To The PEARL CONTINENTAL"<<endl<<"                  ******"<<endl;
    system("pause");
    system("cls");
    cout<<"How many Rooms you want????\n"; 
    cin>>m;
    i=1;
    while(i<=m)   
    { system("cls");
     srand(time(NULL));
     f=rand()%100;
	
	cout<<"                        Room "<<i<<" data\n";
     
	cout<<"Which type of Room you want :" <<endl<<"1:Royal Sweet   2:Average Sweet";  
	
	cout<<endl;
	cin>>a;
	if(a==1)
	{cout<<"1:Package stay  2:Manual stay\n";
	    cin>>b;
		 if (b==1)
		 {
		  cout<<"\nYour room number is:"<<f;
		  cout<<"\n1:3 Days 2 Nights : 3000 Rs\n2:7 Days 6 Nights : 6000 Rs\n3:15 Days 14 Nights : 10000 Rs\n";
		  cin>>c;
		  
		  cout<<"\nEnter your name:";
		  gets(z[i].name);
		  gets(z[i].name);
		  cout<<"Enter your ID card number:";
		  cin>>z[i].card;
		  cout<<"Enter your Adress:";
		  gets(z[i].adress);
		  gets(z[i].adress);
		 }
         else if(b==2)
         {
	     cout<<"\nYour room number is:"<<f;
	     cout<<"\nHow many days you want to stay ?\n";
          cin>>d;
          e=d*1500;
          cout<<"Your amount is:"<<e<<"Rs";
          
          cout<<"\nEnter your name:";
		  gets(z[i].name);
		  gets(z[i].name);
		  cout<<"Enter your ID card number:";
		  cin>>z[i].card;
		  cout<<"Enter your Adress:";
		  gets(z[i].adress);
		  gets(z[i].adress);
         }
         
    
	 	}
	else if(a==2)
	{cout<<"1:Package stay  2:Manual stay\n";
	    cin>>b;
		 if (b==1)
		 { cout<<"\nYour room number is:"<<f;
		  cout<<"\n1:3 Days 2 Nights : 2500 Rs\n2:7 Days 6 Nights : 4500 Rs\n3:15 Days 14 Nights : 8000 Rs\n";
		  cin>>c;
		  
		  cout<<"\nEnter your name:";
		  gets(z[i].name);
		  gets(z[i].name);
		  cout<<"Enter your ID card number:";
		  cin>>z[i].card;
		  cout<<"Enter your Adress:";
		  gets(z[i].adress);
		  gets(z[i].adress);
		 }
         else if(b==2)
         {
	     cout<<"\nYour room number is:"<<f;
	     cout<<"\nHow many days you want to stay ?\n";
          cin>>n;
          h=n*1000;
          cout<<"Your amount is:"<<g<<"Rs";
          
          cout<<"\nEnter your name:";
		  gets(z[i].name);
		  gets(z[i].name);
		  cout<<"Enter your ID card number:";
		  cin>>z[i].card;
		  cout<<"Enter your Adress:";
		  gets(z[i].adress);
		  gets(z[i].adress);
         }
         
      }
      
	 i++;
      
    }
    cout<<"Your total amount is :"<<e+g;
    return 0;
}
Try using descriptive variables, as abcdefg are not clear to what they are supposed to be for. Also, What kind of error are you getting? Post it.
Topic archived. No new replies allowed.