vector index values

I am working on a graph and want to pass the value of an index in my vector to a string argument. any ideas.

basically
string(myvec[1], ' ')

this is so after I get the console window to display white space in the amount of the index value I can place an x difining the point on the graph.
string(myvec[1], ' ')
Is this supposed to be the string contructor? Because this matches no std::string contructor.
http://www.cplusplus.com/reference/string/string/string/

I'm not really sure what you're asking here.
I'm not sure I understand. If you have an up-to-date compiler you can use std::to_string to convert an integer to a string.
http://en.cppreference.com/w/cpp/string/basic_string/to_string
hey guys thanks for the reply and so the question is not clear I know. what I am trying to do is creat a graph in the console window and use vector index values as x and y corridinates. This is what I have so far after working on the problem for a while.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main()
{
	
	cout<<"Enter positive whole numbers 1-15."<<endl;
	vector <int> myvec;
	int nums;
	while(cin>>nums)
	{
		myvec.push_back(nums);
	}

	sort(myvec.begin(),myvec.end());
	for(int i=0;i<myvec.size();++i)
	{
		cout<<myvec[i]<<" ";
	}
	if(myvec.size()%2==0)
	{
		 
		cout<<endl<<((myvec[myvec.size()/2]+myvec[((myvec.size()-1)/2)])/2.0)<<endl;                   
	}
	else
	{
		cout<<endl<<myvec[((myvec.size()-1)/2)]<<endl;             
	}
	cout<<"Here is the first and second index graphed."<<endl;
	cout<<"y axis"<<endl;
	for(int i=15;i>0;i=i-1)
	{
		cout<<i<<endl;
	}
	for(int i=1;i<myvec[0];++i)
	{
		cout<<" ";
	}
	cout<<"x"<<endl;
	for(int i=1;i<myvec[1];++i)
	{
		cout<<"|"<<endl;
	}
	for(int i=0;i<16;++i)
	{	
		cout<<i;
	}
	cout<<"x axis"<<endl;

This does not work in that the y axis does not properly display a numerically decrementing for loop starting at 15 and stopping at 1 other wise it does put x on the proper point on the graph any help to make it better
Topic archived. No new replies allowed.