Problem about output text in my Personal Project

I am having quite a bit of trouble just getting user input/ or even storing strings, etc. so let me lay out my problem.

Personal Project, so no limits, I do like to know how stuff works though.

Array or Vector
C_Strings, Strings, Char Array;

I understand those are what I have to work with.
I want to make a list of choices for the user, and store them so that I can easily print them out by calling their number.
Also the user will only enter in a number, then the number will correspond to the choice, so therefore I only really need to output all of the options in a timely manner.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 #include <iostream>
#include <vector>
#include <string>
vector<string> user_choices;
void initializeChoices(vector<string>& user_choices);
using namespace std;
int main(){
	initializeChoices(user_choices);
	cout << "Hello, which number would you like to pick?" << endl;
	for (int i = 0; i < 1; i++){
		cout << i << ": " << user_choices[i] << endl;
	}
	return 0;
}
void initializeChoices(vector<string>& user_choices){
	user_choices.push_back("Choice 1");
}


My code so far. I know it is wrong, the compiler went crazy with errors.
Thank's!
Ads: Chúng tôi chuyên cung cấp dịch vụ internet và truyền hình cho toàn quốc, bạn có thể tham khảo một số bài viết của chúng tôi tại một số địa chỉ sau:
http://www.internetvietnam.net/2015/02/dang-ky-lap-dat-internet-tai-quan-ha-dong.html
http://www.internetvietnam.net/2015/02/dang-ky-lap-dat-internet-tai-quan-dong-da.html
http://www.internetvietnam.net/2015/02/dang-ky-lap-dat-internet-fpt-tai-quan-cau-giay.html
http://www.internetvietnam.net/2015/02/dang-ky-lap-dat-internet-fpt-tai-quan-ba-dinh.html
http://www.internetvietnam.net/2015/02/dang-ky-lap-dat-internet-fpt-tai-huyen-thuong-tin.html
http://www.internetvietnam.net/2015/02/dang-ky-lap-dat-internet-tai-huyen-thanh-tri.html
http://www.internetvietnam.net/2015/03/dang-ky-lap-dat-intenet-tai-quan-thanh-xuan.html
Mời các bạn ghé thăm quan.



Last edited on
Code is fine by the way.

Just a little omission:
1
2
std::vector<std::string> user_choices;
void initializeChoices(std::vector<std::string>& user_choices);
Last edited on
Topic archived. No new replies allowed.