Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

how can i give the user a choice in my code C++

+1 vote
asked Mar 29, 2020 by marc23 (130 points)
#include <iostream>
#include <conio.h>
#include <stdlib.h>
using namespace std;
int main()
    char name[50];
    cout << "What is your name, wanderer?" << endl;
    cin.getline(name, 50);
    cout << "You better move fast, " << name << ". The ghouls are attacking the town." << endl;
    cout << "\n----------------------Press any key to continue----------------------" << endl;

1 Answer

0 votes
answered Mar 30, 2020 by Bambofy (480 points)
What do you mean by give the user a choice? you are already giving the user a choice by asking them what their name is
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.