It seems that my code is way off.
I get no errors from this code, but the output is...er...VERY interesting.
Code:
//Cube volume calculating program v2.0
//calculates the difference between two 3-dimensional objects
typedef unsigned short USHORT;
#include <iostream>
using namespace std;
USHORT areaOfObj1(USHORT length, USHORT width, USHORT height);
USHORT areaOfObj2(USHORT length, USHORT width, USHORT height);
int main() {
cout << "\t\tCube Volume Calculating Program v2.0" << endl;
cout << "\t Calculates the difference between the volume" << endl;
cout << "\t of one cube to the volume of another." << endl;
USHORT Obj1length;
USHORT Obj1width;
USHORT Obj1height;
USHORT Obj2length;
USHORT Obj2height;
USHORT Obj2width;
USHORT Obj1volume;
USHORT Obj2volume;
USHORT Obj1and2dif;
Obj1volume = areaOfObj1(Obj1length, Obj1width, Obj1height);
Obj2volume = areaOfObj2(Obj2length, Obj2width, Obj2height);
cout << "\n\tWhat is the length of the first cube?" << endl;
cin >> Obj1length;
cout << "\n\tWhat is the width of the first cube?" << endl;
cin >> Obj1width;
cout << "\n\tWhat is the height of the first cube?" << endl;
cin >> Obj1height;
cout << "\n\tWhat is the length of the second cube?" << endl;
cin >> Obj2length;
cout << "\n\tWhat is the width of the second cube?" << endl;
cin >> Obj2width;
cout << "\n\tWhat is the height of the second cube?" << endl;
cin >> Obj2height;
Obj1and2dif = Obj1volume - Obj2volume;
cin.get();
cout << "The volume of the first cube is " << Obj1volume << endl;
cout << "The volume of the second cube is " << Obj2volume << endl;
cout << "\nThe difference between the volume of" << endl;
cout << "the first cube and the second cube is: " << Obj1and2dif << endl;
cin.get();
return 0;
}
USHORT areaOfObj1 (USHORT l, USHORT w, USHORT h) {
cin.ignore();
cin.get();
return l * w * h;
};
USHORT areaOfObj2 (USHORT l, USHORT w, USHORT h) {
cin.ignore();
cin.get();
return l * w * h;
};
I'm making logical errors. Please help me! Thanks!