Code Clean-up

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
#include <iostream>
#include <string>
#include <limits>

using namespace std;

int main()
{
	int monthlymins = 0, overA = 0, overB = 0, month = 0, minA, minB;
	double planA, planB, costA = 0, costB = 0, totaloverA = 0, totaloverB, yearlyA = 0, yearlyB = 0;
	
	//banner
	cout << "Welcome to WireMore. Here you will be able to compare two plans, enjoy!" <<endl;
	cout <<"        Remember, there are no rollover minutes allowed!!!" <<endl;
	cout <<"A charge of 0.35 cents per minute will apply to minutes you go over monthly" <<endl;
	
	//loop to ensure positive input
	do
	{
		cout << "\nPlease enter your monthly price for Plan A: $";
		cin >> planA;
		
		cout << "Enter the number of minutes allowed monthly for Plan A: ";
		cin >> minA;
	}while(planA <= 0 || minA <= 0 );
	
	do
	{
		cout << "Please enter your monthly price for Plan B: $";
		cin >> planB;
		
		cout << "Enter the number of minutes allowed monthly for Plan B: ";
		cin >> minA;
	}while(planB <= 0 || minB <= 0);
	
		cout << "\nPlease enter the number of minutes you used each month for the past 12 months:\n";
		
		//loop for monthly minutes input
		for (month = 1; month <=12; ++month )
		{
			do
			{
		  	       cout << "Month  " << month << ":  ";
			       	cin >> monthlymins;
			}while (monthlymins <= 0);
				
				//calcs the over charges if mintues used it greater than minutes allowed
				if (monthlymins > minA)
				{
					overA += (monthlymins - minA);
                }
					
						if (monthlymins > minB)
						{
							overB += (monthlymins - minB);
					
						}
					
		}
	//calc for plan A 				
	costA = planA * 12;
	totaloverA = overA * .35;
		
	//calc for plan B
	costB =  planB * 12;
	totaloverB = overB * .35;
		
	//yearly total for A and B
	yearlyA = costA + totaloverA;	
	yearlyB = costB + totaloverB;
		
	cout.setf(ios::fixed);
	cout.setf(ios::showpoint);
	cout.precision(2);
		
	//determines which plan it better and how much the user will save
	if(costA < costB)
	{
		cout << "\nThe plan best suited for you is Plan A,"<<endl;
		cout <<"Which totals yearly to: $" << yearlyA <<endl;
		cout << " You will save " << ( yearlyB - yearlyA ) << " by using Plan A instead!!";
				
    }
		else
			{
				cout << "\nThe plan best suited for you is Plan B, "<<endl;
				cout <<"Which totals yearly to: $" << yearlyB <<endl;
				cout << " You will save " << (yearlyA-yearlyB) << " by using Plan B instead!!\n";
			}
		
 //ending banner	
 cout << "\nThanks for using the Comparison Computer.\n";  
 cout << "\nPress ENTER to quit.";
 cin.get();
 getchar();
 
return 0;
}

What do you want us to do? You need to be more specific.
oops, sorry to include that part. But I was asking if this is a correct format/indenting. And if not is there a specific way I should be formatting
It's quite inconsistent...if you make it consistent, it's generally fine. There are many styles, just pick one you like and stick with it.
what makes it inconsistent? im fairly new to coding so my question are generally silly lol
I would suggest having your braces line up a big nicer { and }'s . The ones, especially near the bottom are mis-aligned a bit.
Okay, i see what your saying. Thanks!! :)
Topic archived. No new replies allowed.