Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is the code that I have done can you tell me what is wromg with this code a

ID: 3757561 • Letter: T

Question

This is the code that I have done can you tell me what is wromg with this code and can you show your out put of the code if there is anything wrong with it. it is in c++

#include

#include

#include

#include

#include

#include

using namespace std;

struct menu

{

char menu;

  

};

class menuclass{

public:

void menu() {

  

}

};

int main()

{

ofstream output;

output.open("ggh;\output.txt");

output <<" ch:"<

output <<"**************************************** ";

output<<"Information to identify the case: ";

string fname, lname

string Enter yes, Enter_no;

  

output.close();

menuclass menuobject;

menuobject.menu();

string menu, enter,showresults, choice;

string repet;

string search, line;

  

  

cout<<"Loading the file........"<

int menu=0;

int ch=-1;

int pos,t;

  

int i;

pos =0;

t=0;

struct menu;

  

string displayall;

while(ch!=-1)

  

cout << "Please pick one of the following drinks below" << endl;

cout <<"1.Display all of the information"<< choice<

cout <<"2.Search by first name" << choice<< endl;

cout <<"3.Search by last name"<< choice<< endl;

cout <<"4.Search by user number" << choice<< endl;

cout <<"5.5Search by book chapter" << endl;

cout<<"6.Edit "<< endl;

cout<<"7.repet"<

   cout <<"8.Exit program"<

getline(cin, search);

cin >> enter;

  

  

cin >> showresults;

   cin >> menu;

switch (menu)

{

case 1:

  

  

if(menu==1)

cout<<"Fname"<<" "<<"Lname"<<" "<<"casenumber"<<" "<<"chapter"<<" "<<"edit information"<

  

   for( int i =0; i <=-1; i++ )

{ pos=0;

t=1;

}

{ cout << "pressd 1" << endl;

return 0;

}

break;

  

case 2:

  

cout << "Search by first name" << endl;

cin >> enter;

if(search==fname)

{

cout <<"show results"<

  

}

else if (search>fname)

{

cout << "User name not found"<< endl;

}

for( i = 0; i < -1; i++)

  

if (menu==2)

{

pos=0;

t=1;

  

  

  

return 0;

  

  

}

cout<<"Show results."<

  

case 3:

  

if (menu==3)

{ cout << "pressed 3" << endl;

cout << "Search by last name" << endl;

cin >> enter;

if(search==lname)

{

cout <<"show results"<

  

}

else if (search>lname)

{

cout << "User name not found"<< endl;

}

for( i = 0; i <1; i++ )

getline(cin,enter);

  

  

  

  

  

  

break;

  

cout <<"repet"<

cout <<"Do you want to continue and repet previous choice"<

cout<<"Enter yes to repet"<

cout <<"Enter no to not repet"<

cin>> Enter_yes>> Enter_no;

  

{ cout <<" You have chosen to repet your previous choice"<

  

}

  

  

  

  

using namespace std::chrono;

  

return 0;

}

  

}

}

Explanation / Answer

Removed all Error and commented on the statement where the error are occurig as i don't have the txt file so i cant figure it out that whats your program doing but it will work free from error

#include<bits/stdc++.h> //libraries are no included

using namespace std;

struct menu
{
char menu;
};

class menuclass{

public:

void menu() {

}
};

int main()
{
ofstream output;
output.open("ggh;\output.txt");
output <<" ch:"<<endl; //statement not closed
output <<"**************************************** ";
output<<"Information to identify the case: ";
string fname, lname; // ; is not used
string Enter_yes, Enter_no; // forget to make underscore in Enter_yes
output.close();
menuclass menuobject;
menuobject.menu();
string menu, enter,showresults, choice;
string repet;
string search, line;
cout<<"Loading the file........"; // ; is not used and < this is used for no reason
int menu1=0; //already declare menu as a structure and menu as a string
int ch=-1;
int pos=0,t=0;
int i;
struct menu;
string displayall;
while(ch!=-1)
{
cout << "Please pick one of the following drinks below" << endl;
cout <<"1.Display all of the information"<< choice<<endl; //statement not closed
cout <<"2.Search by first name" << choice<< endl;
cout <<"3.Search by last name"<< choice<< endl;
cout <<"4.Search by user number" << choice<< endl;
cout <<"5.5Search by book chapter" << endl;
cout <<"6.Edit "<< endl;
cout <<"7.repet"<<endl; //statement not closed
cout <<"8.Exit program"<<endl; //statement not closed
getline(cin, search);
cin >> enter;
cin >> showresults;
cin >> menu1;
switch (menu1)
{
case 1:
if(menu1==1)
cout<<"Fname"<<" "<<"Lname"<<" "<<"casenumber"<<" "<<"chapter"<<" "<<"edit information"<<endl; //statement not closed
for( int i =0; i <=-1; i++ )
{
pos=0;
t=1;
}
{
cout << "pressd 1" << endl;
return 0;
}
break;
case 2:
cout << "Search by first name" << endl;
cin >> enter;
if(search==fname)
{
cout <<"show results"<<endl; //statement not closed
}
else if (search>fname)
{
cout << "User name not found"<< endl;
}
for( i = 0; i < -1; i++)
if (menu1==2)
{
pos=0;
t=1;
return 0;
}
cout<<"Show results."<<endl; //statement not closed
case 3:
if (menu1==3)
{
cout << "pressed 3" << endl;
cout << "Search by last name" << endl;
cin >> enter;
if(search==lname)
{
cout <<"show results"<<endl; //statement not cloased
}
else if (search>lname)
{
cout << "User name not found"<< endl;
}
for( i = 0; i <1; i++ )
getline(cin,enter);
break;
cout <<"repet"<<endl; //statement not closed
cout <<"Do you want to continue and repet previous choice"<<endl; //statement not closed
cout<<"Enter yes to repet"<<endl; //statement not closed
cout <<"Enter no to not repet"<<endl; //statement not cloased
cin>> Enter_yes>> Enter_no;
cout <<" You have chosen to repet your previous choice";
return 0;
}
}
}
}

if you have doubts than comment

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote