# Thread: Strings and Characters in arrays.

1. Write a function to convert a letter to a number.
Write a function to convert a number to a letter.

Quzah.

2. ok
just while im in the middle of trying stuff then....
I noticed that when I have

temp = pow(array1[i],3);

it calculates the right number,

but if I have

temp = pow(array1[i],7);

it doesnt calculate the number to the power of 7 correctly. Does the pow() function not allow past a certain number?
Is there anyway I could make this work....

3. ok wait i have to use something larger than an int dont i?

4. ## ahhhhh!

ok i donno

Code:
```int i;
double temp2;
double cseven[30];

printf("\n Decryption: \t");
for (i=0; i<length; i++) {
temp2 =  pow(array1[i],7);
cseven[i] = temp2%33;
printf(" %f  ", cseven[i]);```
}

when I try longints, it doesnt work, when I try floats or doubles I know it works because if I print out temp2 afterwords it is correct. But if I then do: cseven[i] = temp2%33; etc... as above when compiling I get the error:

illegal use of floating point in function
temp2 is assigned a value that is never used...

5. Perhaps you should convert the double into an int and then do it Not sure it'll work but it's just an idea.

6. nope now im gettin the wrong answer again

7. It seems you cant modulus a float or double,
and when i do this....

Code:
```int i;
double temp2;
int cseven[30];
long temp3;

printf("\n Decryption: \n");
for (i=0; i<length; i++) {
temp2 = pow(array1[i],7);
temp3 = temp2;
printf(" %ld \n ", temp3);
printf(" %ld \n ", temp3%33);
}```
It seems to only work to an extent, if array1[i] is like over a certain number, it won't work. It works if array1[i] is 21, but not 26.
so stuck.....

8. 26^7 is what number? Big. Too big in fact to fit in a 32 bit number. You can't hold infinity in 32 bits.

Quzah.

9. Yea i figured size was the problem, The answer for 26^7 is 8031810176. I just wanted to know was there a way to get around it.

10. ## yay

ok figured out how to get the right answer,

after using alot of temps!

Code:
```printf("\n Decryption: \n");
for (i=0; i<length; i++) {
temp2 = (double)pow(ciphertext[i],7);
temp3 = temp2/33;
temp5 = temp3;
temp6 = temp5;
temp4 = temp6*33;
printf(" temp 5 is %ld \n\n ", temp5);
printf(" temp 4 is %f \n ", temp4);
temp7 = temp2-temp4;
cseven[i] = temp7;
printf(" temp 7 is %d \n ", cseven[i]);
}```
It prints the correct answers as would using %. Thanks for all help given.