Can you all know the error im having?

i have a slight error
in about line 57 something didnt add properly im not really good at this yet
please help me with this?


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

int main ()
{
int choice;
int channel;
int con;

double total;

double A = 25;
double B = 90;
double C = 90;
double D = 7.50;
double E = 5.00;

//Display
cout << " \t\t\tCable Company Billing\n\n";
cout << "1. For Residence Customers\n";
cout << "2. For Business Customers\n";
cout << "Enter your choice 1 or 2: ";
cin >> choice;

if (choice >=1 && choice <=2)
{
cout << "How many Premium channels subscribed in?: ";
cin >> channel;



switch (choice)
{
case 1:
{
total = A + (channel)*D;
break;
}
case 2:
{
	if(channel > 0)
	{
		channel = 50;
	}
total = B + (channel);
break;
}



default:
cout<<"You enter a wrong value!"<<endl;
cout << "The valid choices are 1 through 3. \n Run the program again.";

}
{
	if(choice = 2) //Here the total will just be total it wont add the (con-10)*D; 
{
	cout << "How many connections All in All?: ";
cin >> con;
switch (choice)
	case 3:
{
total = B + (con - 10)*D;    //here it will only tell the total it wont add up the(con-10)*D;
break;
}
}
}


cout << "The total charges is equal to: $"<<total<<endl;
}

else if (choice !=2)

{
cout << "The valid choices are 1 through 2. \n Run the program again.";
}
return 0;
}
Last edited on
Use [code][/code] tags. I have no idea where line 57 is.
Done already sorry bout that im new to this yet :D
if(choice == 2) // Note the second '='!
Always use the following style , when having a comparison of a scalar with a variable in any conditional statement.
if(2 == choice) , rather than if(choice == 2), since the first one will not compile if == is typed as = by mistake.
i want when i choose 1 i dont want to see the "how many connections subscribe"
please help i think im almost near
proceed to line 30 pls


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

int main ()
{
int choice;
int channel;
int con;

double total;

double A = 25;
double B = 90;
double C = 90;
double D = 7.50;
double E = 5.00;

//Display
cout << " \t\t\tCable Company Billing\n\n";
cout << "1. For Residence Customers\n";
cout << "2. For Business Customers\n";
cout << "Enter your choice 1 or 2: ";
cin >> choice;

if (choice >=1 && choice <=2)
{
cout << "How many Premium channels subscribed in?: ";
cin >> channel;
}
if (2 == choice) //if i choose 1 i cant get the answer. i want that if i someone choose two there must be a next question "how many connections described" if i choose 1 i dont want ot see these
{
cout <<"How many Connections subscribe?";
cin >> con;



switch (choice)
{
case 1:
{
total = A + (channel)*D;
break;
}
case 2:
{
	if(channel > 0)
	{
		channel = 50;
	}
total = B + (channel) + (con - 10)*E;
break;
}



default:
cout<<"You enter a wrong value!"<<endl;
cout << "The valid choices are 1 through 3. \n Run the program again.";

}


cout << "The total charges is equal to: $"<<total<<endl;
}

else if (choice !=2)

{
cout << "The valid choices are 1 through 2. \n Run the program again.";
}
return 0;
}
Last edited on
Topic archived. No new replies allowed.