how do i turn this C++ code into flowchart?
how do i turn this C++ code into flowchart?
void read_menu(MENU menu[], MENU roti[], MENU nasi[], MENU mee[], MENU air[], NUMBER &num, bool &quit)
{
ifstream input("menu.txt");
char checking[5];
num.total = 0;
num.roti = 0;
num.mee = 0;
num.nasi = 0;
num.air = 0;
if(!input)
{
cout << "System Error : Input_File Malfunction" << endl;
quit = true;
system("pause");
}
else{
while(input){
input.getline(checking, 5, '|');
if(checking[0] == 'R'){
strcpy(roti[num.roti].code,checking);
input.getline(roti[num.roti].item, 50, '|');
input >> roti[num.roti].price;
input.ignore();
num.roti++;
num.total++;
}
else if(checking[0] == 'N'){
strcpy(nasi[num.nasi].code, checking);
input.getline(nasi[num.nasi].item, 50, '|');
input >> nasi[num.nasi].price;
input.ignore();
num.nasi++;
num.total++;
}
else if(checking[0] == 'M'){
strcpy(mee[num.mee].code, checking);
input.getline(mee[num.mee].item, 50, '|');
input >> mee[num.mee].price;
input.ignore();
num.mee++;
num.total++;
}
else if(checking[0] == 'A'){
strcpy(air[num.air].code, checking);
input.getline(air[num.air].item, 50, '|');
input >> air[num.air].price;
input.ignore();
num.air++;
num.total++;
}
}
input.close();
}
ifstream in_file("menu.txt");
for(int n = 0; n < num.total; n++){
in_file.getline(menu[n].code, 5, '|');
in_file.getline(menu[n].item, 50, '|');
in_file >> menu[n].price;
in_file.ignore();
}
in_file.close();
return;
}
Step by step
Solved in 2 steps with 1 images