How to select string?

Nov 12, 2011 at 3:48am
So if i have several strings and want to select one to display, how do i do that? (code below)

#include <iostream>
#include <fstream>
using namespace std;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
int main(){
    cout << "blahblah";
    string a="blahblah";
    string b="blahblah";
    string c="blahblah";
    string d="blahblah";
    string e="blahblah";
    string f="blahblah";
    string choice;//selects which string to display (cout)
    cin >> whichone;
    cout << //?
    cout <<endl<<"blahblah\n";
    system("PAUSE");
}
Nov 12, 2011 at 4:14am
I don't understand the question.

11. cout << e;

is this what you want?
Nov 12, 2011 at 5:57pm
I am wanting the user to enter which string and then display that particular string
Last edited on Nov 12, 2011 at 8:23pm
Nov 12, 2011 at 11:52pm
Oh, come on, people. It's just a switch statement (or if-else chain) that he wants.
http://cplusplus.com/doc/tutorial/control/#switch

-Albatross
Topic archived. No new replies allowed.