I'm having a heck of a time with this code....I think my concept of pointers is a little screwy. Maybe someone can help....
#include <stdio.h>
#include <conio.h>
void main(void)
{
int *num, num2, encrptNum, i;
num = getche();
clrscr();
for (i=0;i<strlen(num);i++)
{
num2 = num2 + num;
num++;
}
if (num2 < 10)
encrptNum = num + 2;
if (num2 > 9 && num2 < 26)
encrptNum = num + 3;
if (num2 > 25)
encrptNum = num + 24;
printf("Original number was %d\n\n", num);
printf("Encrypted value is %d\n\n\n", encrptNum);
printf(" Press enter to continue..."
getche();
}
Ryan
#include <stdio.h>
#include <conio.h>
void main(void)
{
int *num, num2, encrptNum, i;
num = getche();
clrscr();
for (i=0;i<strlen(num);i++)
{
num2 = num2 + num;
num++;
}
if (num2 < 10)
encrptNum = num + 2;
if (num2 > 9 && num2 < 26)
encrptNum = num + 3;
if (num2 > 25)
encrptNum = num + 24;
printf("Original number was %d\n\n", num);
printf("Encrypted value is %d\n\n\n", encrptNum);
printf(" Press enter to continue..."
getche();
}
Ryan