既然下定决心,就要持之以恒!C Primer Plus! 这仅仅只是开始……2015.5.10...
分类:
其他好文 时间:
2015-05-10 13:00:49
阅读次数:
241
这一章主要说的是输入输出流的概念和对于输入输出的简单应用。 说过的概念: ·缓冲区 在使用控制台程序编写程序时,使用输入函数输入内容时,输入的内容总是会在键入换行符\n后才完成输入,之前不论增减还是更改“输入”的内容,都不会确定最终的输入结果。而在玩游戏或者实时的按键操作时,任何一个按键,...
分类:
其他好文 时间:
2015-05-09 23:27:12
阅读次数:
249
既然下定决心,就要持之以恒!C Primer Plus 这仅仅只是开始……2015.5.9...
分类:
其他好文 时间:
2015-05-09 10:19:25
阅读次数:
121
抛出问题:
先附上书本中的例题程序代码
#include
int main(){
int ival;
while (std::cin >> ival, !std::cin.eof()){
if (std::cin.bad())
throw std::runtime_error("IO stream corrupted");
if (std::cin.fail()){...
分类:
编程语言 时间:
2015-05-08 22:04:45
阅读次数:
193
既然下定决心,就要持之以恒!C Primer Plus 这仅仅只是开始……2015.5.8...
分类:
其他好文 时间:
2015-05-08 16:35:22
阅读次数:
134
#include
#include
#include
using namespace std;
int main()
{
vector spvec;
string str;
while(cin>>str)
{
string *sp = new string;
*sp = str;
spvec.push_bac...
分类:
编程语言 时间:
2015-05-07 22:14:45
阅读次数:
168
(一)inline函数(摘自C++ Primer的第三版)在函数声明或定义中函数返回类型前加上关键字inline即把min()指定为内联。 inline int min(int first, int secend) {/****/}; inline 函数对编译器而言必须是可见的,以便它能够在调用点内...
分类:
其他好文 时间:
2015-05-07 18:46:11
阅读次数:
120
#include
#include
int main()
{
std::vector ivec;
int temp;
while(std::cin>>temp)
ivec.push_back(temp);
int *cp =new int[ivec.size()];
for(std::vector::iterator iter=ivec...
分类:
编程语言 时间:
2015-05-07 16:55:21
阅读次数:
180
#include
#include
int main()
{
const char *cp1 = "Hello!";
const char *cp2 = "How are you.";
size_t len = strlen(cp1) + strlen(cp2);
char *result = new char[len];
strcpy(result,...
分类:
编程语言 时间:
2015-05-07 16:52:55
阅读次数:
130
#include
#include
int main()
{
const int buf_size = 1024;
char *str1, *str2;
str1 = new char[buf_size];
str2 = new char[buf_size];
std::cin >> str1 >> str2;
int result;...
分类:
编程语言 时间:
2015-05-07 14:34:00
阅读次数:
148