真的帮帮忙
xcode吧
全部回复
仅看楼主
level 2
笑带伤暖 楼主

//
// main.cpp
// C+
+3
29写文件
//
// Created by xiaodaishangnuan on 12-5-2.
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#include <iostream>
#include<fstream>
using namespace std;
int main()
{
ofstream out("grade");
if(!out)
{
cout<<"Cannot open the grade file."<<endl;
return 1;
}
out<<"C++"<<" "<<89.5<<endl;
out<<"English"<<" "<<93.5<<endl;
out<<"Maths"<<" "<<87<<endl;
out.close();
return 0;
}
////////当我执行这个文件时,只说成功,却没有输出什么,当我执行下面文件时,却也只是成功,也没看到输出什么,如何在xcode 打开流文件,
/
/
/
/
/
/
/
/
/
/
/
/
/
//
// main.cpp
// C++330读文件
//
// Created by xiaodaishangnuan on 12-5-2.
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#include <iostream>
#include<fstream>
using namespace std;
int main()
{
ifstream in("grade");
if(!in)
{
cout<<"Cannot open the grade file.\n";
return 1;
}
char course[32];
float grade;
in>>course>>grade;
cout<<course<<" "<<grade<<'\n';
in>>course>>grade;
cout<<course<<" "<<grade<<'\n';
in>>course>>grade;
cout<<course<<" "<<grade<<'\n';
in.close();
return 0;
}

2012年05月02日 15点05分 1
1