xâu(độ dài và chữ hoa)
#include<stdio.h> XÂU #include<conio.h> DO DAI+ CHU HOA
#include<string.h>
#include<ctype.h>
void nhapxau(char s[50])
{
printf ("nhap xau: ");
gets (s);
}
void xuatxau(char s[50])
{
puts (s);
}
void chuhoa (char s[50])
{
printf ("chuyen chu thuong thanh chu hoa: %s",strupr (s));
}
char ktd(char s[50])
{
int i;
toupper (s[0]);
for (i=1;i<strlen(s);i++)
if (s[i]==' ')
toupper (s[i++]);
}
int main()
{
char s[50];
nhapxau(s);
xuatxau(s);
chuhoa (s);
printf ("
do dai xau ky tu cua chuoi la: %d",strlen(s));
printf ("
chuyen cac ky tu dau tien cua moi tu sang chu hoa la: %s",ktd(s));
getch();
}
Bạn đang đọc truyện trên: Truyen4U.Com