I need C++ console application code to follow the diagrams in the image that I p
ID: 3677322 • Letter: I
Question
I need C++ console application code to follow the diagrams in the image that I posted.
program goes like this:
output: "how long have you had your symptoms?"
input: if user chooses less than 10 days
output: "most colds last 3 to 7 days."
output:"what were the first symptoms you noticed? /n" << SC for (sore throat and congestion)
or SF for(sore throat and fever)
input: if user chooses SF then
output: "does anything else hurt other than your throat?"
input: if yes
output: "you have the flu."
input: if No
output: "you have a strep throat."
if user chooses SC then
output:"how many days have you had a sore throat?"
input: if less than 3 days
output: "you have a cold"
if more than 3 days
output: "you have a strep throat which is also know as Fuso bacterium."
*All this falls under less than 10 days. If user chooses more than 10 day when asked how long have you had your symptoms.
then I would follow the diagram down that is in the picture that I posted. If you need anymore clarifications let me know.
Explanation / Answer
Hi, I have writen C++ program according to your need. If anything need to change then let me know or you can go through code and can easly change according to your need.
#include<iostream>
using namespace std;
int main(){
int numOfDay;;
string symptomType;
string ans;
cout<<"how long have you had your symptoms?: ";
cin>>numOfDay;
if(numOfDay < 10){
cout<<"most colds last 3 to 7 days."<<endl;
cout<<"what were the first symptoms you noticed? /nSC for (sore throat and congestion)or SF for(sore throat and fever): ";
cin>>symptomType;
if(symptomType.compare("SF") == 0){
cout<<"does anything else hurt other than your throat(yes/no)?: ";
cin>>ans;
if(ans.compare("yes") == 0)
cout<<"you have the flu."<<endl;
else if(ans.compare("yes") == 0)
cout<<"you have a strep throat."<<endl;
}
else{
cout<<"how many days have you had a sore throat?: ";
cin>>numOfDay;
if(numOfDay < 3)
cout<< "you have a cold"<<endl;
else
cout<<"you have a strep throat which is also know as Fuso bacterium."<<endl;
}
}else{
cout<<"How is your head feeling?: ";
cin>>ans;
if(ans.compare("Heavy I can barely lift it off my pillow") == 0){
cout<<"feeling pain around your eyes and nose is normal."<<endl;
cout<<"does the rest of your body feel fatigue? (yes/no): ";
cin>>ans;
if(ans.compare("yes") == 0)
cout<<"you have the flu."<<endl;
else
cout<<"you have a sinus infection."<<endl;
}else if(ans.compare("Okay, but the runny nose and sneezing won't quit") == 0){
cout<<"your immune system is likely excited ."<<endl;
cout<<"what is the color of the mucus? ";
}
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.