the size of a doghouse with 1 sqrt feet 15,50 and the user enters their amount budgeted for the dog house

Can some one give me a hand with this code,i know i must use cmath library.
Last edited on
A squareroot foot?
Feet sorry about that
1 squareroot feet?
A program that computes the size of a dog house with the cost per square foot is 15.50 euros with the user entering their budgeted amount ok
I don't understand your question.

You need to use <cmath> if you use sqrt(15.5);
Oh!

so...
1
2
cin >> budget;
cout << budget / sqrt(15.50);
ok thanks will try that
#include <iostream>
#include <cmath>


using namespace std;
int main ()
{
double budget ;
cout<< budget 10 / sqrt (15.50);
cin>> budget;

system("pause");
return 0;
}

Is it like that and change budget to a number
you forgot to declare your doghouse. you can use mine :
void doghouse (int ***, int***, int***) //3 dimensional doghouse
then you can call it whenever you'd like.

(also)
cin>> budget; //input
cout<< budget / sqrt (15.50); //output
(should work better)
Last edited on
ok will try that cheers,should i put the cin before the cout
yes
#include <iostream>
#include <cmath>

void doghouse (int lenght = 10 , int with = 10, int height = 5);
using namespace std;
int main ()
{
double budget ;
cout<< 10 / sqrt (15.50);
cin>> budget doghouse;

system("pause");
return 0;
}

like that is it
ok it complided, now can i just put a euro sign in front of the 15.50
no, you have to use EuroC++ if you want to complide euros. Standard C++ only complides with $!
Remember that your doghouse only works if dogs are using them!
Try this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
#include <cmath>

using namespace std;
int main ()
{
	double budget ; 
	cout << "Enter your budget: ";
	cin>> budget;
	cout<< "You can build a doghouse this big: " << budget / sqrt (15.50);

	system("pause"); 
	return 0;
}
Last edited on
#include <iostream>
#include <cmath>
//void doghouse (int lenght = 10 , int with = 10, int height = 5);

using namespace std;
int main ()
{
double budget ;
cout << "Enter your budget: ";
cin>> 10;
cout<< "length = 10,with = 10,height = 5, " << 10 / sqrt (15.50);

system("pause");
return 0;
}

can't get that to compile sor
you forgot to declare the dogs for your doghouse.

use this :
void dog(int) {
cout<<"Woof woof woof I am a happy dog";
}

then in your main :

int main() {
int Rex, dog2;
dog(Rex);
dog(dog2);
doghouse(length (in milemetres), with (in milimetres), height (in meters) )
}
don't forget that dogs have to eat and sleep as well, so declare your eating, playing and sleeping functions accordingly.

if you don't want to go that far: use Stewbond's code
cin >> something means that you are entering a number into the variable 'something'.

You can do cin>>10. In this line you are trying to enter a number into the constant number 10 which doesn't make any sense.

And yeah, you can get rid of
void doghouse (int lenght = 10 , int with = 10, int height = 5)

timmyyy was messing with you.
#include <iostream>
#include <cmath>


using namespace std;
int main ()
{
double budget ;
cout << "Enter your budget: ";
cin>> budget;
cout<< "length = 5(meter's),with = 5(meter's),height = 5(meter's) , "<< budget / sqrt (15.50);

system("pause");
return 0;
}
like that,it will compile but meters in() on screen,will i declare meter's as a char
Topic archived. No new replies allowed.