Question: Here is my main.cpp class : #include #include #include unit.h #include regist.h using namespace std; int main() { ifstream infile( rinput.txt ); if( !infile )

Here is my main.cpp class :

#include

#include

#include "unit.h"

#include "regist.h"

using namespace std;

int main()

{

ifstream infile( "rinput.txt" );

if( !infile ) return -1;

Registration R;

infile >> R;

ofstream ofile( "routput.txt" );

ofile << R

<< "Number of Units = " << R.GetCount() << ' '

<< "Total credits= " << R.GetCredits() << ' ';

Unit aUnit( "dstructs", "ICT283", 2 );

aC.SetCredits(5);

cout << aUnit << endl;

return 0;

}

"This is from the a'nswer sheet but what I do not understand is that,

whenever I click build and run, CodeBlocks keep telling me that line 25 which is

aC.SetCredits(5) has an error.

I do not even know what aC. means in C++.

Can you please modify that line please?"

p.s) Below, I copied and pasted Unit.h class just in case.

#ifndef UNIT_H

#define UNIT_H

#include

#include

using namespace std;

const unsigned UNIT_NAME_SIZE = 10;

const unsigned UNIT_ID_SIZE = 7;

class Unit

{

public:

Unit();

Unit( const char * name, char * unitId, unsigned credits);

unsigned GetCredits() const;

void SetCredits( unsigned cred );

friend ostream & operator << (ostream & os, const Unit & unitObj);

friend istream & operator >> (istream & input, Unit & unitObj);

private:

char m_name[UNIT_NAME_SIZE];

char m_unitId[UNIT_ID_SIZE];

int m_credits;

};

#endif

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!