一个接一个地接受多个输入

问题描述 投票:0回答:0

...C++

#include <iostream>
using namespace std;

int main() {

    char Name;
    cout<<"Enter name ";
    cin>>Name;

    int Age;
    cout<<"Enter age ";
    cin>>Age;
   

    bool Gender; //0 is female and 1 is male
    cout<<"Enter Gender, {O for female, and any other number for male} ";
    cin>>Gender;
   

    bool Married;
    cout<<"Is he/she married, {0 for unmarried and any other number for married} ";
    cin>>Married;

}

我希望它打印一个语句,然后继续接受输入。接受输入后打印另一个语句,然后接受另一个输入。目前,它打印第一条语句,接受输入,然后一起打印其余语句。

c++ user-input multiple-input
© www.soinside.com 2019 - 2024. All rights reserved.