如何用空格来整个句子 [英] How to cin whole sentence with whitespaces

查看:86
本文介绍了如何用空格来整个句子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有

    char tab[200];
    cin>>tab;
    cout<<tab<<endl;

我希望即使我在控制台输入 / code>所有3个字符和空格立即进入标签

and i would like to make that even if I input in console A B C all the 3 chars and spaces go into tab at once .

推荐答案

使用 cin.getline()

char tab[200];
cin.getline(input,200);
cout<<tab<<endl;

这篇关于如何用空格来整个句子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆