In a switch statement for C++, I believe you are allowed to use either int or char in the switch. For my purposes, I want to use a char. The char I want to use is the a char from a string. Here is my function:
#include <string>
using namespace std;
...
int calindex(string* seq)
{
int index = 0;
for(int i=0;i<seq.length();i++)
{
switch(seq[i])
{
...
}
}
return index; // index is modified within the switch statement
}
However, when I compile I get an error for the line: "switch(seq[i]" that states "switch quantity not an integer". Can anyone see what I did wrong?
seq.length()
whenseq
is a pointer.