I am new to programing and this code is straight off the Deitel "how to program C".
program is suppose to turn lowercase chars to uppercase char.
I ran it in MS visual studio 2010.
1.made a new project
2.and chose win32 /win32console application/console application-empty project
3.add a .cpp file to source file
4.type the code and ran it.
FAULT
There were no errors but program didn't convert chars to upper case.
CODE
#include #include #include "conio.h"
void conva(char *sPtr);
int main(void)
{
char string[] = "cdfg";
printf("the string before conversion is: %s
",string);
conva(string);
printf("
the string after conversion is:%s
",string);
return 0;
}
void conva(char *sPtr)
{
printf("puka");
while (*sPtr !=''){
if (islower(*sPtr)){
*sPtr=toupper(*sPtr);
}
++sPtr;
_getch();
}
}
OUTPUT
the string before conversion is: cdfg
puka