就是建立一个文件然后不用手动输入了只需点一下运行然后自动生成一个输出的文件,,?新手求教啊
提供具体的一个简单的实例就好,我脑残求别提供途径不懂
求讲一下c/c++编程怎么建立一个输入输出文件?
答案:2 悬赏:10
解决时间 2021-03-22 06:35
- 提问者网友:冥界祭月
- 2021-03-21 23:13
最佳答案
- 二级知识专家网友:何必打扰
- 2021-03-22 00:46
#include
#include
using namespace std;
int main()
{
cout<<"Press any key to create file."<
system("pause > nul");
fstream fout("test.txt", ios::out);
fout<<"Testing output."<
fout.close();
return 0;
}
你要Windows窗口的话就烦很多了。。这里就写个控制台的。错误检测也没写,那个一般都无所谓。
#include
using namespace std;
int main()
{
cout<<"Press any key to create file."<
fstream fout("test.txt", ios::out);
fout<<"Testing output."<
return 0;
}
你要Windows窗口的话就烦很多了。。这里就写个控制台的。错误检测也没写,那个一般都无所谓。
全部回答
- 1楼网友:输掉的尊严
- 2021-03-22 01:00
#include
// main
int main()
{
int a;
scanf_s("%d", &a);
char b[41] = { 0 };
char* p = b;
int i = 32;
while(i--)
{
*p++ = (a >> i & 0x1) + '0';
if(i % 4 == 0)
*p++=' ';
}
printf_s("%s\n", b);
return 0;
}
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯