Here is my code so far. I'm pretty stumped on how to get this working right.
Code:
#include <iostream>
#include <fstream>
#include <cmath>
#include <iomanip>
using namespace std;
void heading();
void printStars();
void printLines();
double areaCircle(ifstream& inp);
int main()
{
ifstream fin;
ofstream fout;
char shape;
double radius, length, width, base, height;
fin.open("datalog.txt");
fout.open("myresults");
if (!fin) {
cout << "There was an error in opening that file." << endl;
cout << "Program is now shutting down..." << endl;
return 1;
}
while (!fin.eof()) {
fin >> shape;
switch (shape) {
case 'C': fin >> radius;
fout >> areaCircle(inp);
break;
case 'R': fin >> length;
fin >> width;
break;
case 'T': fin >> base;
fin >> height;
}
}
fin.close();
fout.close();
return 0;
}
void heading()
{
cout << "SHAPES-R-US COMPUTING" << endl;
cout << endl;
cout << "Prepared by:" << endl;
cout << endl;
cout << "Programmer" << endl;
cout << endl;
cout << "April 1st, 2005";
}
void printStars()
{
int count;
for (count = 0; count < 50; count++) {
cout << "*";
}
}
void printLines()
{
int count;
for (count = 0; count < 50; count ++) {
cout << "-";
}
}
double areaCircle(ifstream& inp)
{
double area;
area = 3.14 * pow(inp, 2);
return 0;
}