#include <iostream> #include <iomanip> #include <fstream> using namespace std; c
ID: 3678802 • Letter: #
Question
#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
const int STAR_FACTS = 5;
const int PREF_WIDTH = 23;
void PrintMenu(string fileName);
bool IsStarNameValid(string fileName, string starName);
void AddStarToFileFromUserInput(string fileName);
void PrintStarFacts(string fileName, string starName);
//Do not change anything below this line
//you will lose points. That includes these comments.
//EXACTMATCH
int main(){
bool runProgram = true;
string fileName = "stars.dat";
string userSelection;
while(runProgram){
PrintMenu(fileName);
cout << "Enter Star Name, or Add, or Quit: ";
getline(cin, userSelection);
if(userSelection == "Add"){
AddStarToFileFromUserInput(fileName);
}
else if(userSelection == "Quit"){
runProgram = false;
}
else{
if(IsStarNameValid(fileName, userSelection)){
PrintStarFacts(fileName, userSelection);
}
else{
cout << "Invalid Star Name ";
}
}
}
}
//EXACTMATCH
Explanation / Answer
void GetFile(char * fileName) { //Prompt user for binary file std::coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.