Kindly assist EMERGENCY

Pages: 12
I need to run a program that enables a Cab company to obtain data of registered drivers and users, number of app downloads and number of usage of apps per day. you can make assumptions on numbers where necessary. My code is not running....

any kind assistance would be highly appreciated. MY CODE Not GIVING DESIRED RESULTS

#include <iostream>
using namespace std;

int main(){
int a, b, c,d,e,f;
cout<<"booking1: "<<endl;
cin>>a;
cout<<"Booking2: "<<endl;
cin>>b;
cout<<"booking3: "<<endl;
cin>>c;

// assume number of uber users and dormant downloads
a= 3;
d=0;
b=4;
c=2;
c= a + b;

e= c + l; //number_of_app_downloads

f= e-l; //number of use

switch(n) {
case 1:
if (f>=c)
{
cout<<"total number of registered accounts is : "<< c <<endl;}
break;
case 2:
if (f>=e)
{
cout<<"total number of downloads is: "<< e <<endl;}
break;
case 3:
if (f>=f)
{
cout<<"number of usage"<< f <<endl;}
break;

default:
cout<<"Please re-book"<<endl;
break;}

return 0;
}
Last edited on
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
#include <iostream>
using namespace std;

int main(){
int a, b, c,d,e,f;
cout<<"booking1: "<<endl;
cin>>a;
cout<<"Booking2: "<<endl;
cin>>b;
cout<<"booking3: "<<endl;
cin>>c;

// assume number of uber users and dormant downloads
a= 3; 
d=0;
b=4;
c=2;
c= a + b;

e= c + l; //number_of_app_downloads

f= e-l; //number of use

switch(n) {
case 1:
if (f>=c)
{
cout<<"total number of registered accounts is : "<< c <<endl;}
break;
case 2:
if (f>=e)
{
cout<<"total number of downloads is: "<< e <<endl;}
break;
case 3:
if (f>=f)
{
cout<<"number of usage"<< f <<endl;}
break;

default:
cout<<"Please re-book"<<endl;
break;}

return 0;	
}
what is n you never iniaized it, or am i missing it.
line 24
Last edited on
Ok... First user the Code blocks, use [code] [ /code]

Variable "n" is not declared nor initialized...


another thing....

1
2
3
4
5
6
7
int a, b, c,d,e,f;
cout<<"booking1: "<<endl;
cin>>a;
cout<<"Booking2: "<<endl;
cin>>b;
cout<<"booking3: "<<endl;
cin>>c;

Booking1 is now equal to "a"
Booking2 is now equal to "b"
Booking3 is now equal to "c"


1
2
3
4
5
a= 3; 
d=0;
b=4;
c=2;
c= a + b;


Booking1 = 3
Booking2 = 4
Bookind3 = 7


even if the user enter any number on the booking1,2,3 the values of Booking1 will always be 3, Booking2 will always be 4 and booking3 will always be 7 i'm not sure if that's what you want but, that's whats going on on your code...

suggestion: use variable that are meaningful so when you ask for help other can read the program and know easily whats going on :>
Last edited on
AM NOt getting expected result....please help
What results are you expecting?

You need to fix your compile errors already pointed out before you will even get any output.

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
Last edited on
it is showing me only one result regardless my varied inputs: the DEFAULT.
Your assignments below line 13 resets the values inputted. Remove lines 14, 16 and 17 and it should work as expected
hi bro! please i dont really get your point @lazpeng. could you expatiate?
You say this problem is emergency... How much time do you have left before the deadline?
hi bro! tomorrow. kindly assist.
Ok. You declare the variables. You assigned values to them on lines 7, 9 and 11. They now contain what you served as input. But on lines 14, 16 and 17 you assign them new values, discarding the previous ones you had from cin.
Referring to the line numbers in rezy3312's post:

please i dont really get your point @lazpeng. could you expatiate?

Lines 7,9,11: You input a,b,c from the user. Lines 14,16-17: You now overwrite what you input from the user with constants. What's the point of asking the user for the values if you're going to overwrite what they input?

You haven't posted any corrected code, so we don't know if you've made any of the corrections already suggested.

Line 24: n is not defined.

Line 36: This if statement makes no sense. It will always be true. f will always be equal to f.

BTW, your variable names suck. They convey no useful information to the reader.




@AbstractionAnon...please help....am a beginner/novice

I need to run a program that enables a Cab company to obtain data of registered drivers and users, number of app downloads and number of usage of apps per day. you can make assumptions on numbers where necessary. My code is not running....

any kind assistance would be highly appreciated. MY CODE Not GIVING DESIRED RESULTS
What is it about AbstractionAnon's post that you don't understand? He's shown you exactly which lines the problems are on, and explained what's happening on those lines to cause you problems.

If there's something specific you don't understand, then ask specific questions to get clarification. Just saying "please help" is useless, because it gives us no idea what it is that you don't understand, and it gives the impression that you're ignoring the help that you've been given.
Last edited on
@MikeyBoy
Can you please run the edited code?.....not running on my part....please help
Are there no sound programmer in c++ that can help with this program....please help..
No profficient C++ programmer under this thread in the house?? any c++ sound programmers that can help with this apparently simple program yet hard to solve?
closed account (48T7M4Gy)
Part of your problem is you evidently can't use code tags. I'll do it for you but you'll have to fix up your 3 errors and initialise the variables or type them in properly if the l's are meant to be 1's. Up to you, it's that simple:

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
#include <iostream>
using namespace std;

int main(){
    int a, b, c,d,e,f;
    cout<<"booking1: "<<endl;
    cin>>a;
    cout<<"Booking2: "<<endl;
    cin>>b;
    cout<<"booking3: "<<endl;
    cin>>c;
    
    // assume number of uber users and dormant downloads
    a= 3;
    d=0;
    b=4;
    c=2;
    c= a + b;
    
    e= c + l; // IS THIS SUPPOSED TO BE l or perhaps 1. If it's l initilaise it
    
    f= e-l; // SAME THING
    
    switch(n) { // SAME THING BUT n THIS TIME
        case 1:
            if (f>=c)
            {
                cout<<"total number of registered accounts is : "<< c <<endl;}
            break;
        case 2:
            if (f>=e)
            {
                cout<<"total number of downloads is: "<< e <<endl;}
            break;
        case 3:
            if (f>=f)
            {
                cout<<"number of usage"<< f <<endl;}
            break;
            
        default:
            cout<<"Please re-book"<<endl;
        break;}
    
    return 0;
}
Last edited on
Help! i have corrected as previously instructed....can you run the corrected program and see....all the previous correction are not working....please run and kindly help.

assumtion 3 drivers and 3 users, total of 3 usage of apps per day, 1 dormant download, total downloads=4

the instruction is to run a program to print total number of downloads, total number of users(both drivers and users), number of use per day....that is all.....no proficient programmer that can help with this apparently simple yet difficult to solve this program....

any assistances is humbly appreciate
Pages: 12