kiem tien, kiem tien online, kiem tien truc tuyen, kiem tien tren mang
Friday, January 9, 2015


//Bài 6. Viết chương trình đão ngược nội dung của một file văn bản. 
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<conio.h>
void dao(char *a)
{
for(int i=0;i<strlen(a)/2;i++)
{
char c=a[i];
a[i]=a[strlen(a)-1-i];
a[strlen(a)-1-i]=c;
}
}
void main()
{
FILE *t;
t=fopen("E:\\bai6.txt","w+");
if(t==0)
{
printf("error\n");exit(0);
}
char s[1000];
char cd;
printf("nhap: ");fflush(stdin);gets(s);
fprintf(t,"%s\n",s);
printf("--noi dung dao nguoc\n");
rewind(t);
fgets(s,1000,t);
dao(s);
fprintf(t,"%s\n",s);
fgets(s,1000,t);
printf("%s\n",s);
fclose(t);
}

0 comments:

Post a Comment

domain, domain name, premium domain name for sales

Popular Posts