Question
the c++ code works only if i enterd from the services but if i chose otheror abcit won't work the way it should be- please
the c++ code works only if i enterd from the services but if i chose "other"or "abc"it won't work the way it should be- please don't change alot of the code and plz after you fix the problem rewrite the whole code with changes and explain why please don't delete the sorting or shifting functions i need them to be in my code
#include
void Ask(string &z){// Function for Searching in array while (true) { cout<< " Your emergency?"; cout << endl; cin>> z; bool valid = false; for (int i = 0 ; i< size ; i++){ if (services[i].find(z,0)!= string::npos){ valid = true; cout<< "Your choice is "<< services[i]< void get_data(Info *array,int S){ cout<< "Enter Your first name, age, location and any additional note"< } int main(){ string temp[size]; string tem; Info Array [5]; string answer; string repla; cout<< " 911 What's your emergency? " ; cout<< endl; for(int i = 0; i get_data(Array,5);// Calling Function to get data fron user cout<<"Okay " << Array[0].name << " calm down, we will send you help "; cout<< "Your Name: "<<"\t"<< Array[0].name << " "; cout<< "Your Age: "<<"\t"<< Array[1].age << " "; cout<< "Your Location: "<<"\t"<< Array[2].location << " "; cout<< "Additional Note: "<<"\t"<< Array[3].AdditionalNote << "\t"; cout<<" "<<" Please enter 1 if your info are right or 2 if you need to modify"; cin>> answer; if (answer == "2"){ string Qrep; string Qrepp; string rep; int repp; int replaa; cout<<"Do you want to replace? Enter Y or N"<< endl; //Adding value cin>> Qrep; if(Qrep == "Y"){ cout << "Is it your age? Enter Y or N"<< endl; cin >> Qrepp; if (Qrepp == "Y"){ cout<< "Enter your real age please!"<< endl; cin>> repp; } Array[1].age=repp; }if (Qrepp=="N"){ // Updating values cout << "Enter your wrong answer "; cin>> rep; cout << "Write your replacementt:"; cin>> repla; if(Array[0].name== rep) Array[0].name=repla; if(Array[2].location== rep) Array[2].location=repla; if(Array[3].AdditionalNote== rep) Array[3].AdditionalNote= repla; } if (Qrep == "N"){ R(); } } cout<<"Okay " << Array[0].name << " Your updated data: "; cout<< "Your Name: "<<"\t"<< Array[0].name << " "; cout<< "Your Age: "<<"\t"<< Array[1].age << " "; cout<< "Your Location: "<<"\t"<< Array[2].location << " "; cout<< "Additional Note: "<<"\t"<< Array[3].AdditionalNote << "\t"<
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