C++ istream::peek()
摘要:
功能:peek函数用于读取并返回下一个字符,但并不提取该字符到输入流中,也就是说,依然让该字符作为将要提取到输入流的下一个字符。例程:#include <iostream>
#include <string> using namespace std; int main()
{ string word; char c; int n; cout << "Please enter a word or a number: "; c = cin.peek(); if(isdigit(c)) { cin >> n; ... 阅读全文
posted @ 2012-12-08 09:38 铁树银花 阅读(1022) 评论(0) 推荐(0)
浙公网安备 33010602011771号