does anybody knows the answer to this? a function that take in an uppercase character parameter. The function returns the next uppercase character if lett is between 'A' and 'Y'. if let=='Z', the function returns 'A'... i tried to do it but after entering a letter, nothing happens... help pls.. need it so urgently....tha nks a lot!
having problem with functions
Collapse
X
-
Hi,
Try this code
ThanksCode:int main() { int lnIpChar; printf("Enter the charecter\n"); lnIpChar=getchar(); printf("%d\n",lnIpChar); if(lnIpChar >= 65 && lnIpChar <= 90) { if(lnIpChar == 90) { lnIpChar = 64; } printf("%c\n",++lnIpChar); } else { printf("%c\n",lnIpChar); } }
RaghuramComment
-
hi zaacze can you post your code to see where you are getting struck upOriginally posted by gpraghuramHi,
Try this code
ThanksCode:int main() { int lnIpChar; printf("Enter the charecter\n"); lnIpChar=getchar(); printf("%d\n",lnIpChar); if(lnIpChar >= 65 && lnIpChar <= 90) { if(lnIpChar == 90) { lnIpChar = 64; } printf("%c\n",++lnIpChar); } else { printf("%c\n",lnIpChar); } }
RaghuramComment
-
Hi,
I executed it and i am getting the output properly.
I entered A and then pressed "Enter" key and got the output as B.
I cant make out why its not happeneing for you
Thanks
RaghuramComment
-
Originally posted by gpraghuramHi,
Try this code
ThanksCode:int main() { int lnIpChar; printf("Enter the charecter\n"); lnIpChar=getchar(); printf("%d\n",lnIpChar); if(lnIpChar >= 65 && lnIpChar <= 90) { if(lnIpChar == 90) { lnIpChar = 64; } printf("%c\n",++lnIpChar); } else { printf("%c\n",lnIpChar); } }
Raghuram
Maybe because your main() is not returning a value.
SavageComment
Comment