Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In C + + , improve the code by creating a separate program, but using the same Questions class to load a text file with
In C improve the code by creating a separate program, but using the same Questions class to load a text file with the questions if it exists allow to edit the list of questions and save them. Then make the first program to load the questions from the file.
#ifndef QUESTIONH
#define QUESTIONH
#include
class Question
private:
std::string question;
std::string ans;
std::string ans;
std::string ans;
std::string ans;
int correct;
public:
Question std::string q std::string a std::string a std::string a std::string a int c constructor
question q; ans a; ans a; ans a; ans a; correct c;
void data const
std::cout question ans ans ans correct std::endl;
std::string, std::cin, std::cout
;
#endif CLASSNAMEH
#include
#include
#include "Question.h
using namespace std;
prototypes USE ONLY IF YOU WILL USE FUNCTIONS
int main
ifstream ifile;
Question quest Question
QuestionFastest land animal", "Cheetah", "Mouse", "Turtle", "Snail",
QuestionLargest State in US "Texas", "California", "Florida", "Alaska",
QuestionStinkiest flower", "Rose", "Titanarum", "Tulip", "Hydrangea",
QuestionBiggest dog breed", "ShiTzu", "Pitbull", "Bulldog", "EnglishMastiff",
QuestionColor of the sun", "Green", "Pink", "Yellow", "Red",
QuestionLongestrunning soap opera", "Daysofourlives", "GuidingLight", "Baywatch", "GeneralHospital",
QuestionHighest grossing Disney movie", "Frozen "LittleMermaid","TheLionKing", "BeautyandtheBeast",
QuestionColor of the sky "Blue", "White", "Grey", "Brown",
QuestionCapitol of Peru", "Caracas", "Lima", "Quito", "Monaco", ;
for int i ; i ; i
questidata;
return ;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started