[ create a new paste ] login | about

Link: http://codepad.org/DjuO6LqN    [ raw code | output | fork ]

C, pasted on Nov 24:
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
int STRLEN(char s[])
{
	int count = 0;
	while (s[count] != '\0')
	{
		count++;
	}
	return count;
}

void STRUPR(char s[])
{
	int length = STRLEN(s);
	for (int i = 0; i < length; i++)
	{
		if (s[i] >= 'a' && s[i] <= 'z')
		{
			s[i] -= 32;
		}
	}
}
int main()
{
	char str1[100];

    printf("Nhap chuoi: ");
	//scanf("%s",str2);
    gets(str1);  // phải dùng gets
	STRUPR(str1);
	printf("\nDoi chu thuong thanh chu hoa: %s", str1);


	getch();
	return 0;
}


Output:
1
2
3
Line 17: error: conio.h: No such file or directory
In function 'STRUPR':
Line 19: error: 'for' loop initial declaration used outside C99 mode


Create a new paste based on this one


Comments: