2016级计算机C++助教工作(9)第三次上课内容

1. cin.peek()    cin.get()  (LYP同学的方法)

int peek();
Peek next character
Returns the next character in the input sequence, without extracting it: The character is left as the next character to be extracted from the stream. 参考:http://www.cplusplus.com/reference/istream/istream/peek/
获取输入流中下一个输入的字符,但是不会提取它,这个字符依然在输入流中。

std::istream::get

single character (1)
int get();
istream& get (char& c);
c-string (2)
istream& get (char* s, streamsize n);
istream& get (char* s, streamsize n, char delim);
stream buffer (3)
istream& get (streambuf& sb);
istream& get (streambuf& sb, char delim);
Get characters
Extracts characters from the stream, as unformatted input: 该方法跟getchar()类似。

http://www.cplusplus.com/reference/istream/istream/get/?kw=cin.get


2.面向对象--构造函数

P297 构造函数的作用,以及缺省构造函数
P300 9.6 错误原因分析
错误实例1:
#include<iostream>
using namespace std;
class TempClass{
public :
    int l;
    TempClass(){
        int l = 5;
    }

};

int main(){
    TempClass temp(2);
}
错误实例2:
class A{
public :
    int s;
    A(int newS){
        s = newS;
    }
    void print(){
        cout << s;
    }

};
int main(){
    A a();   
    a.print();
}

3多维数组

P263 二维数组声明
P267 8.4  二维数组作为参数传递

4,递归

p545   阶乘、斐波那契数列
P556 汉诺塔















评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

GDRetop

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值