Psyc
January 10th, 2006, 03:09 PM
Hi, I'm taking an online C++ course at school and my instructor doesn't know much about C++. The course was basically "read a book and figure it out yourself" type of course.
I have to turn in a midterm by Jan 18. It's scripting something from scratch, of course, but I really didn't learn how to do that. I have some grasp of the language, but it's very little. I was wondering if anyone could guide me and point out any errors to me or show me any methods I should use.
This is what was posted on the course website:
Midterm Project:
As the project for the midterm, please write a program that will compile in C++ that includes:
- Functions and variables
- Classes and Constructors
- Operator Overloading
- Initialization and Assignment
The output can be anything you would like but should be properly coded. Submit your coding project to the instructor for grading and recording. Grades will be based on the output after the instructor compiles them.
This is what I have so far:
#include <iostream.h>
int main () {
cout << "Enter a degree of temperature in Celsius: ";
cin >> c;
cout << "Your temperature, " << c << "C converts to " << c+273 << "K (Kelvin)" << endl;
cout << "Your temperature also converts to: " << 1.8*c+32 << "F";
}
I was just thinking about revolving my code around temperature conversion.
I changed some of it yesterday and forgot how I had it, so now it doesn't run. How can I define c? Is there anyway for me to put it in a "class."
I also read about overloading in the book but I didn't really understand it and I have no idea what the last topic in the midterm requirements is about.
So, can anyone please help me? I would really appreciate it.
I have to turn in a midterm by Jan 18. It's scripting something from scratch, of course, but I really didn't learn how to do that. I have some grasp of the language, but it's very little. I was wondering if anyone could guide me and point out any errors to me or show me any methods I should use.
This is what was posted on the course website:
Midterm Project:
As the project for the midterm, please write a program that will compile in C++ that includes:
- Functions and variables
- Classes and Constructors
- Operator Overloading
- Initialization and Assignment
The output can be anything you would like but should be properly coded. Submit your coding project to the instructor for grading and recording. Grades will be based on the output after the instructor compiles them.
This is what I have so far:
#include <iostream.h>
int main () {
cout << "Enter a degree of temperature in Celsius: ";
cin >> c;
cout << "Your temperature, " << c << "C converts to " << c+273 << "K (Kelvin)" << endl;
cout << "Your temperature also converts to: " << 1.8*c+32 << "F";
}
I was just thinking about revolving my code around temperature conversion.
I changed some of it yesterday and forgot how I had it, so now it doesn't run. How can I define c? Is there anyway for me to put it in a "class."
I also read about overloading in the book but I didn't really understand it and I have no idea what the last topic in the midterm requirements is about.
So, can anyone please help me? I would really appreciate it.