谁帮我把C语言转换成C++?在线等!!很急!谢谢!!
第一个:#include<stdio.h>intmain(){inti=0;charc;FILE*data;data=fopen("asc.txt","w+");for(...
第一个:#include <stdio.h>
int main(){
int i = 0;
char c;
FILE * data;
data = fopen("asc.txt","w+");
for(i = 32; i<=127; i++)
{
fprintf(data,"%c",i);
}
fclose(data);
return 0;
}
第二个:#include <stdio.h>
int main(){
int i = 0;
char c;
FILE * data;
data = fopen("asc.txt","r");
i = 0;
while((c = fgetc(data))!=EOF)
{
printf("%c",c);
if(i%40==0)
printf("\n");
i++;
}
fclose(data);
return 0;
} 展开
int main(){
int i = 0;
char c;
FILE * data;
data = fopen("asc.txt","w+");
for(i = 32; i<=127; i++)
{
fprintf(data,"%c",i);
}
fclose(data);
return 0;
}
第二个:#include <stdio.h>
int main(){
int i = 0;
char c;
FILE * data;
data = fopen("asc.txt","r");
i = 0;
while((c = fgetc(data))!=EOF)
{
printf("%c",c);
if(i%40==0)
printf("\n");
i++;
}
fclose(data);
return 0;
} 展开
2个回答
展开全部
第一个:
#include <iostream>
#include <stdio.h>
using namespace std;
int main(){
int i = 0;
char c;
FILE * data;
data = fopen("asc.txt","w+");
for(i = 32; i<=127; i++)
{
cout<<data<<endl;
}
fclose(data);
return 0;
}
第二个:
#include <iostream>
#include <stdio.h>
using namespace std;
int main(){
int i = 0;
char c;
FILE * data;
data = fopen("asc.txt","r");
i = 0;
while((c = fgetc(data))!=EOF)
{
cout<<c<<endl;
if(i%40==0)
cout<<endl;
i++;
}
fclose(data);
return 0;
}
另外,把文件名改成(原来***.c)***.cpp
还有什么不对 的再说!
#include <iostream>
#include <stdio.h>
using namespace std;
int main(){
int i = 0;
char c;
FILE * data;
data = fopen("asc.txt","w+");
for(i = 32; i<=127; i++)
{
cout<<data<<endl;
}
fclose(data);
return 0;
}
第二个:
#include <iostream>
#include <stdio.h>
using namespace std;
int main(){
int i = 0;
char c;
FILE * data;
data = fopen("asc.txt","r");
i = 0;
while((c = fgetc(data))!=EOF)
{
cout<<c<<endl;
if(i%40==0)
cout<<endl;
i++;
}
fclose(data);
return 0;
}
另外,把文件名改成(原来***.c)***.cpp
还有什么不对 的再说!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询