Hi everybody
Thanks again for your helps in my last thread.
Now, I have some more problems. :(
50 Errors for this program. Certainly, a basic problem within the structure of class "Block".
This assignment is all about "Class and objects". We can use functions, but no arrays.
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
using namespace std;
ofstream outfile ("lab8.out");
ifstream infile ("lab8.in.text");
class Block
{
public:
double weight, friction, force;
};
int main ()
{
infile>>friction>>weight>>angle1>>angle2>>angle3>>angle4>>angle5>>angle6>>angle7>>angle8>>angle9;
Block angle1, angle2, angle3, angle4, angle5, angle6, angle7, angle8, angle9;
force.angle1==(weight-(weight*friction))/cos(angle1);
force.angle2==(weight-(weight*friction))/cos(angle2);
force.angle3==(weight-(weight*friction))/cos(angle3);
force.angle4==(weight-(weight*friction))/cos(angle4);
force.angle5==(weight-(weight*friction))/cos(angle5);
force.angle6==(weight-(weight*friction))/cos(angle6);
force.angle7==(weight-(weight*friction))/cos(angle7);
force.angle8==(weight-(weight*friction))/cos(angle8);
force.angle9==(weight-(weight*friction))/cos(angle9);
outfile<<"Angle (Degrees)\t"<<"Force, F(KN)"<<endl
<<"---------------\t"<<"------------"<<endl;
cout<<"Angle (Degrees)\t"<<"Force, F(KN)"<<endl
<<"---------------\t"<<"------------"<<endl;
outfile<<setw(5)<<setfill(' ')<<angle1<<setw(6)<<force.angle1<<endl
<<setw(5)<<setfill(' ')<<angle2<<setw(6)<<force.angle2<<endl
<<setw(5)<<setfill(' ')<<angle3<<setw(6)<<force.angle3<<endl
<<setw(5)<<setfill(' ')<<angle4<<setw(6)<<force.angle4<<endl
<<setw(5)<<setfill(' ')<<angle5<<setw(6)<<force.angle5<<endl
<<setw(5)<<setfill(' ')<<angle6<<setw(6)<<force.angle6<<endl
<<setw(5)<<setfill(' ')<<angle7<<setw(6)<<force.angle7<<endl
<<setw(5)<<setfill(' ')<<angle8<<setw(6)<<force.angle8<<endl
<<setw(5)<<setfill(' ')<<angle9<<setw(6)<<force.angle9<<endl<<endl;
cout<<setw(5)<<setfill(' ')<<angle1<<setw(6)<<force.angle1<<endl
<<setw(5)<<setfill(' ')<<angle2<<setw(6)<<force.angle2<<endl
<<setw(5)<<setfill(' ')<<angle3<<setw(6)<<force.angle3<<endl
<<setw(5)<<setfill(' ')<<angle4<<setw(6)<<force.angle4<<endl
<<setw(5)<<setfill(' ')<<angle5<<setw(6)<<force.angle5<<endl
<<setw(5)<<setfill(' ')<<angle6<<setw(6)<<force.angle6<<endl
<<setw(5)<<setfill(' ')<<angle7<<setw(6)<<force.angle7<<endl
<<setw(5)<<setfill(' ')<<angle8<<setw(6)<<force.angle8<<endl
<<setw(5)<<setfill(' ')<<angle9<<setw(6)<<force.angle9<<endl<<endl;
infile.close();
outfile.close();
return 0;
}