I have to write a program for class and i have everything done but get an error on the very last line and i'm not really sure why. Here is what i have so far.
#include <iostream>
using namespace std;
int main()
{
int num1 = 0;
int num2 = 0;
{
cout << "Enter Two Numbers To Compare " << endl;
cin >> num1 >> num2;
if (num1<num2)
{
cout << num2 << " is the larger number" << num1 << " and " << num2 << " is the smallest number" << endl;
}
else if (num1>num2)
{
cout << num1 << " is the larger number" << num2 << " and " << num1 << " is the smallest number" << endl;
}
system ("PAUSE");
return 0;
} <------this is where i'm getting the error when i try to compile it
Thanks got it to run but now i'm not getting the output i need but atleast its working. He didn't say anything about if it equaled just which is larger but i will try and figure that one out as well.
output:
Enter two numbers to compare
1
5
5 is the larger number1 and 5 is the smallest number
#include <iostream>
using namespace std;
int main()
{
int num1 = 0;
int num2 = 0;
cout << "Enter Two Numbers To Compare " << endl;
cin >> num1 >> num2;
if (num1<num2)
{
cout << num2 << " is the larger number" << num1 << " and " << num2 << " is the smallest number" << endl;
}
else if (num1>num2)
{
cout << num1 << " is the larger number" << num2 << " and " << num1 << " is the smallest number" << endl;
}
system ("PAUSE");
return 0;
}
Project 2 was create a program that will accept a number as input and output whether the number is even or odd. Got it to work just want to make sure it all looks right. Thanks
using namespace std;
int main(int argc, char *argv[])
{
int num;
cout << " Enter number to evaluate " << endl;
cin >> num;
if (num%2==0)
{
cout << num << " is an even number" << endl;
}
else
{
cout << num << " is an odd number" << endl;
}
Project 3 i'm completely lost
Given the approriate dimensions (ft) to a room and a cost of flooring per square foot, output the total cost of the flooring. The room can be rectangular or circular. the program should hand either case.
if (choice == 1)
{
cout << "Enter the lenght" << endl;
cout << "Enter the width" << endl;
cout << "Enter the costPerSqFt" << endl;
Total Cost = (lenght*width*costPerSqFt) // what values are currently stored inside of lenght, width, and costPerSqFt?
}
i'm lost, i'm to new to this and don't think i'm going to be able to get it done. I know it has to be something simple that i am missing and just can't figure it out.
int main()
{
int choice = 0;
double cost, totalCost;
while(choice !=1 && choice!=2){
cout << "1. Rectangual Room" <<endl;
cout << "2. Circular Room" <<endl;
cin >> choice;
}
cout << "What is the cost of flooring per sq ft?: ";
cin>> cost;
if (choice == 1)
totalCost = rectangular(cost);
else
totalCost = circular(cost);
cout << fixed << setprecision(2) << "Total cost of Flooring is: $" << totalCost <<endl; <--this is where i'm getting my problem at
return 0;
}