xbox live 2 month

Anyone that can give me the code to get my program to compile and work ill give u a xbox live 2 month. thanks guys

ALright so basically your suppose to tell the program the length and width of room and cost per sq foot. And the program should calculate the total including labor and tax cost. So basically the program just adds tax and labor the length width and cost per square foot are user entered. The labor and tax cost are both constant. Labor = 0.35 Tax=0.05.






#include <iostream>
#include <iomanip>
using namespace std;
void get_data(int & length,int& width,float costpersqfoot);
float InstalledPrice(int length,int width,float costpersqfoot);
float totalprice(float installion);
void printdata(int length,int width,float price);
const float LABOR_COST=0.35;
const float TAX_RATE=0.05;
int main ()
{
int length,width;
int count;
cout << " Enter number of mesurements to input";
cin >> count;

for (int i=1; i <=count; i++)
{
get_data (length,width);
float Installedprice = length * width * float costpersqfoot + LABOR_COST;
cout << " Your installed price is" <<
setprecision(2) << length * width * float costpersqfoot + LABOR_COST + TAX_RATE << endl;
cout << " Your total price is" <<

}
system("PAUSE");
}
void get_data (length,width)
{
cout << " Enter length";
cin >> length;
cout << " Enter width:";
cin >> width;

}
float InstalledPrice (int length, int width)
{
return length * width * float costpersqfoot + LABOR_COST;
}
float totalprice (int length, int width)
{
return length * width * float costpersqfoot + LABOR_COST + TAX_RATE ;
}
1) This post of yours should be in beginners forum.
2) What issue are you facing with this code?
Im not sure its not compiling. I'm missing something lol. Plz help.
There are so many mistakes. Lets start by fixing your functions. what do you think following lines of code mean?
void get_data(int & length,int& width,float costpersqfoot);
get_data (length,width);
I know it won't compile successfully but it will certainly give you some errors. Copy paste your errors here so that I can help you fix them. With out error list I can't. :P
Last edited on
closed account (S6k9GNh0)
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
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>

using namespace std;

const float LABOR_COST=0.35;
const float TAX_RATE=0.05;

int main ()
{
	int length,width;
	int count;
	float costpersqfoot;

	for(;;)
	{
		std::string input;

		cout << "Please enter the cost per square foot: ";
		getline(cin, input);

		stringstream myStream(input);
		if (myStream >> costpersqfoot)
			break;

		cout << "Invalid, please try again" << endl;
	}

    for(;;)
	{
		std::string input;

		cout << "Please enter the count: ";
		getline(cin, input);

		stringstream myStream(input);
		if (myStream >> count)
			break;

		cout << "Invalid, please try again" << endl;
	}

	for (int i=1; i <= count; ++i)
	{
        for(;;)
        {
            std::string input;

            cout << "Please enter a valid width: ";
            getline(cin, input);

            stringstream myStream(input);
            if (myStream >> width)
                break;

            cout << "Invalid, please try again" << endl;
        }

        for(;;)
        {
            std::string input;

            cout << "Please enter a valid width: ";
            getline(cin, input);

            stringstream myStream(input);
            if (myStream >> length)
                break;

            cout << "Invalid, please try again" << endl;
        }

        float basePrice = length * width * costpersqfoot;
        float installPrice = basePrice + (basePrice*LABOR_COST);
        float totalPrice = installPrice + (installPrice*TAX_RATE);

		cout << "Your installed price is " << installPrice << endl;
		cout << "Your total price is " << totalPrice << endl;
	}
	std::cin.get(); //Prevent console from closing.
}


There variables that you didn't exactly explain that I assumed about. Run it a few times to make the functionality is okay. I tried to make it kinda newbie-looking but I'm not used to such a thing anymore. I can also shorten the code here by several lines if need be.

Also, my email is admin@computerquip.com, please email (if still valid) the prize details there or you can PM me through this forum.
Topic archived. No new replies allowed.