Question: not sure why it is doing this help please but only modify and update assessment.h and assessment.cpp assessment.cpp #define _CRT_SECURE_NO_WARNINGS #include Assessment.h #include namespace seneca

not sure why it is doing this help please but only modify and update assessment.h and assessment.cpp

0 File 99 % Edit View Git 1- & AA 5. main.cppX

assessment.cpp

#define _CRT_SECURE_NO_WARNINGS
#include "Assessment.h"
#include

namespace seneca {

   bool read(int& value, FILE* fptr) {
       return fscanf(fptr, "%d", &value) == 1;
   }

   bool read(double& value, FILE* fptr) {
       return fscanf(fptr, "%lf", &value) == 1;
   }

   bool read(char* cstr, FILE* fptr) {
       return fscanf(fptr, ",%60[^\n]\n", cstr) == 1;
   }

   bool read(Assessment& assess, FILE* fptr) {
       double tempMark;
       char tempTitle[61];

       if (fscanf(fptr, "%lf,", &tempMark) == 1 && read(tempTitle, fptr)) {
           assess.m_mark = new double;
           assess.m_title = new char[strlen(tempTitle) + 1];
           *assess.m_mark = tempMark;
           strcpy(assess.m_title, tempTitle);
           return true;
       }

       return false;
   }

   void freeMem(Assessment*& aptr, int size) {
       for (int i = 0; i            delete aptr[i].m_mark;
           delete[] aptr[i].m_title;
       }
       delete[] aptr;
       aptr = nullptr;
   }

   int read(Assessment*& aptr, FILE* fptr) {
       int numRecords;
       if (!read(numRecords, fptr)) {
           return 0;
       }

       aptr = new Assessment[numRecords];
       int readCount = 0;

       for (int i = 0; i            if (read(aptr[i], fptr)) {
               ++readCount;
           }
           else {
               break;
           }
       }

       if (readCount != numRecords) {
           freeMem(aptr, numRecords);
           return 0;
       }

       return numRecords;
   }

} // namespace seneca
assessment.h

#ifndef ASSESSMENT_H
#define ASSESSMENT_H

#include

namespace seneca {

   struct Assessment {
       double* m_mark;
       char* m_title;
   };

   bool read(int& value, FILE* fptr);
   bool read(double& value, FILE* fptr);
   bool read(char* cstr, FILE* fptr);
   bool read(Assessment& assess, FILE* fptr);
   void freeMem(Assessment*& aptr, int size);
   int read(Assessment*& aptr, FILE* fptr);

} // namespace seneca

#endif // ASSESSMENT_H
main.cpp

#define _CRT_SECURE_NO_WARNINGS

#include
#include
#include
#include "Assessment.h"
#include "Assessment.h"
#include "Assessment.h"
using namespace seneca;
using namespace std;
void display(const Assessment& a);
bool readTesters();
int main() {
   if (readTesters()) {
       int cnt;
       Assessment* aptr = nullptr;
       FILE* fptr = fopen("baddata.txt", "r");
       cnt = read(aptr, fptr);
       if (cnt) {
           cout        }
       else {
           cout        }
       fclose(fptr);
       cout        fptr = fopen("gooddata.txt", "r");
       cnt = read(aptr, fptr);
       if (cnt) {
           for (int i = 0; i                cout                display(aptr[i]);
           }
           freeMem(aptr, cnt);
       }
       else {
           cout        }
       fclose(fptr);
   }
   return 0;
}
void display(const Assessment& a) {
   cout.setf(ios::fixed);// setting the number of digits
   cout.precision(1);    // after the decimal point to 1
   // this will be covered later
   cout }

bool readTesters() {
   FILE* fptr = fopen("gooddata.txt", "r");
   bool passed = true;
   int i;
   double d;
   char str[61];
   if (read(i, fptr) && i == 13) {
       cout    }
   else {
       cout        passed = false;
   }
   if (passed && read(d, fptr) && (d - 70.9) -0.0001) {
       cout    }
   else {
       cout        passed = false;
   }
   if (passed && read(str, fptr) && strcmp(str, "Applied Problem Solving") == 0) {
       cout    }
   else {
       cout        passed = false;
   }
   fclose(fptr);
   return passed;
}

0 File 99 % Edit View Git 1- & AA 5. main.cppX Assessment.h p1 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 18 Project Build Debug Test Analyze Debug x64 Assessment.cpp 8 A Extensions Window Help Local Windows Debugger - - else { cout < < < "bool read (int& value, FILE* fptr) test failed" < < endl; passed= false; Tools (Global Scope) else { cout < < "bool read(double& value, FILE* fptr) test failed" < < endl; passed = false; fclose(fptr); return passed; if (passed && read(d, fptr) && (d - 70.9) < 0.0001 && (d - 70.9) > -0.0001) { cout < < < < "bool read(double& value, FILE* fptr) test passed" < < endl; No issues found else { cout < < < "bool read(double& value, FILE* fptr) test failed" passed = false; if (passed && read(str, fptr) && strcmp(str, "Applied Problem Solving") == 0) { cout < < < "bool read(double& value, FILE* fptr) test passed" Microsoft Visual Studio Error List Immediate Window Output Build succeeded Output Show output from: Build 1>p1.vcxproj-> C:\Users\balit\OneDrive\Desktop\00P244\w2\p1\x64\Debug\p1.exe ========== Build: 1 succeeded, 0 failed, up-to-date, skipped ========== ========== Build completed at 10:54 AM and took 00.510 seconds ========== Please consider donating to VSColorOutput https://mike-ward.net/donate/ (this message can be turned off in the settings panel) Search c Lo 5 X abc p1 Unable to start program CE Q; read Testers() C:\Users\balit\OneDrive\Desktop\OOP244\w2\p1\x64\Debug\ p1.exe'. Operation did not complete successfully because the file contains a virus r potentially unwanted software. 8 OK Ln: 94 Ch: 2 SPC CRLF Solution Explorer 06 Search Solution Explorer (Ctrl+;) Solution 'p1' (1 of 1 project) p1 - References Sign in t PEAL External Dependencies Header Files Assessment.h Resource Files Source Files ++ Assessment.cpp ++ main.cpp Solution Explorer Git Changes Class View Properties Add to Source Control O Windows Security Windows Security x - O. - x Threats found Microsoft Defender Antiviru details. Dism

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 Algorithms Questions!