How do I take string input as a switch case parameter? I am able to do it with an int but not string.
The below code would be working if I was using an int input, but if I change to string it won't work.
#include <iostream>
#include <sstream>
#include <string>
#include <math.h>
class MissionPlan //start of MissionPlan class
{
public:
MissionPlan();
float computeCivIndex(string,int,int,float,float);
}; //end of MissionPlan class
LocationData::LocationData()
{
switch(sunType)
{
case "Type A": //compute
break;
case "Type B": //compute
break;
//and many more case..
default: break;
}
}
int main()
{
for(;;)
{
MissionPlan plan;
}
return 0;
}