Click here to Skip to main content
15,895,606 members

Comments by EDITH GINGRAS (Top 18 by date)

EDITH GINGRAS 24-Nov-10 21:26pm View    
i am not getting an error it just does not give the correct answer example 5 hr at 5 per hour should be 25 dollars I get a random number 871etc and it does not matter what I do with that code it still does the same thi
EDITH GINGRAS 24-Nov-10 8:40am View    
what do you mean fix this I am not seeing what you mean the setup is the same as the others can you be more specific
EDITH GINGRAS 18-Nov-10 21:34pm View    
I tried ti chang this and got these errors and when I do it the other way and put the } in I get return error expecting statement so what is wrong here?
int calwadges() {
int total = twadges * numhours;
}
return total; //gives error s below


1>c:\users\edith\documents\visual studio 2010\projects\wk11\wk11\wk11.cpp(73): error C2059: syntax error : 'return'
1>c:\users\edith\documents\visual studio 2010\projects\wk11\wk11\wk11.cpp(73): error C2238: unexpected token(s) preceding ';'

but if worded
return calwadges(); without the } before return statement it will run but it gives wrong answer input 5hr'6 wadges should produce 30 but I get 681something if I put in the } I get error at return expecting a statement.
EDITH GINGRAS 18-Nov-10 20:47pm View    
how do I fix this to run properly? should I take it out at the bottom in the last section or remove the return but if i remove the return I get needs a return how do I get around this?
EDITH GINGRAS 1-Nov-10 19:53pm View    
Ok I changed the wording and now I am getting
1>c:\users\edith\documents\visual studio 2010\Projects\hwweek9\Debug\hwweek9.exe : fatal error
3 of these in a row how do I fix this? thanks

#include<iostream>
using namespace std;
//Function Header
int myarea(int width,int height,int length);
int mytriangle(double base);
int mycircle (int dist);
int mychoice (int square,int rectangle,int triangle, int circle);
//Main function
int main(){
int choice;
int square =1,rectangle=2,triangle=3,circle=4;
cout << "Enter 1 for square " << square << endl;
cout << "Enter 2 for rectangle " << rectangle << endl;
cout << "Enter 3 for triangle " << triangle << endl;
cout << "Enter 4 for circle " << circle << endl;
cin >> choice;

return choice;
int width,height,length,base,dist;

cout << "Enter the width: ";
cin >> width;
cout << "Enter the height : ";
cin >> height;

if (width == length){
cout << "The area of a square is "<<myarea(width,height,length) <<endl;
}else if (length == height){
cout << "The area of a rectangle is " << myarea(width,height,length) << endl;
}else if (( base * .5) * height){
cout << "The area of a triangle is " << mytriangle(base) << endl;
}else if (dist * 3.14){
cout << " The circumference of a circle is " << mycircle(dist) << endl;


system ("pause");
return 0;
}
//End of program

//Call the function
int myarea(int width,int height,int length);
int mytriangle(int base);
int mycircle (int dist);
int mychoice (int square,int rectangle,int triangle, int circle);

int number;
number = (width * height) || (length * height) || ((base *.5) * height) || (dist * 3.14);
return number;
}
//End of function