I'm very new to c++, and I'm busy trying to teach myself it. My school feels the need to teach Turing (even when we have Visual Studio 6.0 installed on all of the computers), which is probably the most useless programming language in existance. Moving from it to c++ is probably harder than if I had had no programming experience beforehand.
Anyway, I'm a member on the USACO contest site, and I've been working for a good week trying to figure out the syntax to do this problem.
You're given two strings of length 1 to 6, consisting of uppercase letters. You're then supposed to find the product of the string, using the A = 1, B = 2, ... , Z = 26.
Whenever I do it, I get a huge negative number.
Here's my code:
char strGroupName ;
ifstream fin ("ride.in");
int intGroupTotal, intCometTotal = 1;
for (int x = 0; x != 6;x++)
if (strGroupName[x] >= 'A' && strGroupName [x] <= 'Z')
for (int i = 65;(char) i <= 'Z';i++)
if (strGroupName[x] == (char) i)
intGroupTotal = intGroupTotal * (i - 64);
cout << intGroupTotal;
Any help is greatly appretiated.