I'm writing a program in c++ and I'm trying to separate letters like this: "A,B,C"
But it comes out like this, and I don't know why: ",A,B,C".
Help?
My code is below:
#include <iostream>
#include <ctype.h>
using namespace std;
int main()
{
char startChar='Z';
char stopChar='A';
while (startChar>stopChar)
{
cin >> startChar;
startChar = toupper(startChar);
cin >> stopChar;
stopChar=toupper(stopChar);
}
for (char chLoop=startChar; chLoop<=stopChar; chLoop++)
{
if (stopChar > startChar)
cout << ",";
cout <<chLoop;
}
}
thanks!