Hey guys. I just started C++ last week in college and we already got slammed with the first homework assignment. Here is the assignment:
"Write a program that will ask the user to input:
The number of gallons in the tank
The fuel efficiency in miles per gallon
The price of gas per gallon
Then it will print out how far the car can go with the gas in the tank and print the cost per 100 miles."
well I have been killing myself trying to figure it out. All we've done in class so far is the "Hello World" program, and now this homework. So I have read my chapters over and over. This is all I can come up with so far, and of course, it isn't working. Using VS2008 to compile btw(dont know if it matters):
#include <iostream>
{
int main()
int odometer1;
int odometer2;
int gallons;
int mph;
std::cin<<"Enter the first odometer reading... "<<std::endl;
odometer1 = Convert.ToInt32<<std::>>cin;
std::cin<<"Enter the second odometer reading.. "<<std::endl;
public:
static void WriteLine()
"Gas mileage is {0} miles/gal",mph);
public: static String* ReadLine();
}
well there it is.. Its all wrong. I dont even know if im close. I just need some assistance. If anyone can help me out, and point me to the right direction, i'd really appreciate it. Thanks in advance
I dont know. Im an idiot. I think I just read too much and didn't do enough thinking. I dont even think I should take programming. I been fixing computers for 8 years and I just figure I should take the next leap.. But I dont know what public: static String* Readline(); does..
Well, actually it isn't legal that line in a function body, that looks as a declaration for a class method. My question is: What do you want to do at that point?
BTW, I've noticed another error, the 1st brace should be after int main()