摘要:
// 第二十一章流 1流的操作// 1.1 缓冲// 1.2 流和缓冲区// 1.3 标准输入输出对像// 1.4 重定向 重定向的意思是可以重新定向输出的设备// 1.5 对像代表流// 2.0 用count输出/*#include <iostream>using namespace std;int main(){ char *ch = "hello world"; //用强制转换方式将char*指针ch转换为void*之后,输出的就是字符串ch的地址,也就是第一个字符的位置 cout<<(void*)ch<<endl; //输出的&a 阅读全文
posted @ 2012-10-01 13:59
简单--生活
阅读(348)
评论(0)
推荐(0)
摘要:
//第二十一章流 3用cin输入// 1 字符串的输入/*#include <iostream>using namespace std;int main(){ int x; cin>>hex>>x; cout<<x; system("pause"); return 0;}*/// 2 字符串的输入问题/*#include <iostream>using namespace std;int main(){ char word[12]; cin>>word; cout<<word<< 阅读全文
posted @ 2012-10-01 13:59
简单--生活
阅读(362)
评论(0)
推荐(0)
摘要:
// 第二十一章流 4文件的输入和输出// 1输出数据到文件 //(1)包含fstream头文件 //(2)建立ofstream对像 如: ofstream ocout //(3)将对像与文件关联 ocout.open('123.txt'); //(4)该对像可看作cout对像,因此我们使用该对像将数据输出到文件中,而不是屏幕中 ocout<<"abc"; //(5)关闭与文件的连接 count.close();/*#include <iostream>#include <fstream>using namespace s 阅读全文
posted @ 2012-10-01 13:59
简单--生活
阅读(246)
评论(0)
推荐(0)