Here is my code:
What I am trying to do is have the user input a bunch of strings and then the user says which string on the list you just wrote that the program will say back to you.
#include <iostream>
#include <string>
using namespace std;
int amount = 0;
int listnum;
string inpu;
void input(string in){
cout << "Enter a word" << endl;
cin >> in;
}
int main()
{
cout << "How many strings do you want to enter." << endl;
cin >> amount;
string list1[amount];
for(int x = 0; x < amount; x++){
input(inpu);
list1[x] = inpu;
if(x == amount-1){
cout << "Which word on the list do you want to use?" << endl;
cin >> listnum;
cout << list1[listnum] << endl;
}
}
}
I am not sure what is happening so I really would love the help.
Thank you!