随笔 - 9, 文章 - 0, 评论 - 0, 阅读 - 1368

导航

< 2025年6月 >
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 1 2 3 4 5
6 7 8 9 10 11 12

2009年12月20日

#include <iostream>#include <fstream> // file I/O suppport#include <cstdlib> // support for exit()using namespace std;const int SIZE = 20;int main(){ ifstream inFile; cout<<"请输...

posted @ 2009-12-20 11:03 spock 阅读(170) 评论(0) 推荐(0)

2009年12月19日

摘要: 文件格式-----------2name1100name220000-----------#include<iostream> #include<fstream>using namespace std;struct donation{ char name[20]; int money;};void main() { ifstream inFile; cout<&l... 阅读全文

posted @ 2009-12-19 21:08 spock 阅读(159) 评论(0) 推荐(0)

摘要: #include<iostream> #include<fstream>#include<cstdlib>#include<string>using namespace std;struct donation{ string name; double money;};void main() { int n,i; int grand=0,nogra... 阅读全文

posted @ 2009-12-19 19:46 spock 阅读(205) 评论(0) 推荐(0)

2009年12月18日

摘要: 1.包含iostream和fstream; 2.创建一个ofstream的对象; ofstream outFile;3.将这个ofstream对象和一个文件关联起来;outFile.open("carinfo.txt");4.像使用cout一样使用ofstream对象。 outFile<<fixed;//fixed是用一般的浮点数格式输出,scientific是用科学计数法输出 out... 阅读全文

posted @ 2009-12-18 19:50 spock 阅读(220) 评论(0) 推荐(0)

2009年12月17日

摘要: 几点收获:枚举变量是整型的。(?)记得给字符加单引号!#include<iostream> using namespace std;void showmenu();void main() { showmenu(); char choice; cin>>choice; while(choice!='c'&&choice!='p'&&choi... 阅读全文

posted @ 2009-12-17 22:20 spock 阅读(121) 评论(0) 推荐(0)

摘要: #include<iostream> using namespace std;const int MAX=5;void main() { double fish[MAX]; cout<<"请输入鱼的重量,按下任意字母表示停止输入"<<endl; cout<<"最多输入"<<MAX<<"条鱼"<<endl; c... 阅读全文

posted @ 2009-12-17 19:11 spock 阅读(117) 评论(0) 推荐(0)

摘要: 读写键盘输入直到遇到@,并回显输入,数字除外。同时将大写字母转化为小写,小写字母转化为大写。利用cctype函数。#include<iostream> #include<cctype> #include<string>using namespace std;void main() { int n,i; cout<<"输入文本,以@结束测试.\n... 阅读全文

posted @ 2009-12-17 15:33 spock 阅读(136) 评论(0) 推荐(0)

摘要: #include<iostream> #include<cctype> using namespace std;void main() { int n,i; cout<<"输入文本,以@结束.\n"; char ch; int whitespace=0; int digits=0;//数字 int chars=0;//字母 int punct=0;//标点... 阅读全文

posted @ 2009-12-17 15:05 spock 阅读(137) 评论(0) 推荐(0)

摘要: 代码一:[代码]代码二:[代码] 阅读全文

posted @ 2009-12-17 14:43 spock 阅读(103) 评论(0) 推荐(0)

点击右上角即可分享
微信分享提示