在此代码中,如果我想打印用户输入的句子,那怎么可能? [英] in this code , if i want to print the sentence entered by the user then how is it possible?

查看:75
本文介绍了在此代码中,如果我想打印用户输入的句子,那怎么可能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此代码中,如果我想打印用户输入的句子,那怎么可能?

in this code , if i want to print the sentence entered by the user then how is it possible?

#include <iostream.h>
#include <conio.h>
#include <fstream.h>

int main()
{
    char p[80];
    cout << "Enter text :";
    cin >> p;
    
    getch();
    return 0;
}

推荐答案

cout<<p;


const int bufLen = 1024;
char buffer[bufLen];
cin.getline(buffer, bufLen-1);
cout << buffer << endl;


就像这样,
Like this,
cout<<p<<endl;


这篇关于在此代码中,如果我想打印用户输入的句子,那怎么可能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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