Passing a char vector as a function parameter.

My problem seems to show up in "Main". I'm having trouble passing a vector of chars as a function parameter called by another function in "Main". "InputArrayFiller" is the function I can't seem to pass to.I admit that my understanding of passing parameters is a bit shoddy. Most of what I've seen online tells me to try passing it as a reference or to use a pointer (something else I'm not familiar with). I've tried it, but to no avail. I think my problem might lie where I first write the function. I just want to be able to use the vector "intake" in "InputArrayFiller". Any and all help/comments are appreciated.

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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
[code]
#include <iostream>
#include <vector>
using namespace std;

void IntakeManifold (){ 
	vector<char> intake;
	int i=0;
	int InputSize=0;
	cout << "Please enter message to encrypt." << endl << endl;
	if(cin){
	while (cin){
		cin >> intake[i];
		i++;
	}
	int InputSize = intake.size(); 
	cout << InputSize; //this can go away later. Just here as a safety or something...
	}
}

void InputArrayFiller (vector<char> intake, int InputSize){ //not actually an array, but...whatever...
	 vector<vector<int>>InVec;
	 for (int i=0; i < InputSize; i++)
	 {
		 if(intake[i]=='a'){
			 int SubArray[ ] = { 1, 1, 1 };
			 vector<int> vector; //really, naming an object as its data type? classy...
			 vector.assign( SubArray, SubArray + 3 ); //hope this works... LOOK THIS UP LATER
			 InVec[i]== vector;
		 }else if(intake[i]=='b'){
			 int SubArray[ ] = { 1, 1, 2 };
			 vector<int> vector;
			 vector.assign( SubArray, SubArray + 3 ); 
			 InVec[i]== vector;
		 }else if(intake[i]=='c'){
			 int SubArray[ ] = { 1, 1, 3 };
			 vector<int> vector;
			 vector.assign( SubArray, SubArray + 3 ); 
			 InVec[i]== vector;

	//every letter in the alphabet's accounted for in my code, but it's done exactly the same as you see here, so I've omitted it.

		 }else if(intake[i]=='z'){
			 int SubArray[ ] = { 3, 3, 2 };
			 vector<int> vector;
			 vector.assign( SubArray, SubArray + 3 ); 
			 InVec[i]== vector;
		 }else if(intake[i]=='_'){
			 int SubArray[ ] = { 3, 3, 3 };
			 vector<int> vector;
			 vector.assign( SubArray, SubArray + 3 ); 
			 InVec[i]== vector;
		 }else{
		 }
	 }
}

void Rearrange(vector<vector<int>>InVec){
	vector<int>ReTri;
	int TriArrayLength = InVec.size();
	for (int i=0; i < TriArrayLength; i++){
	}
}
//use the "push_back" member function to merge. (This is just for me later)

int main(){
	cout<< "use_underscores_instead_of_spaces"<<endl<<"do_not_use_punctuation"<<endl<< "do_not_use_capital_letters"<<endl; 
	IntakeManifold();
	InputArrayFiller(vector<char> intake, int InputSize);
	return 0;
}

[/code]
The error code is C2275 and it shows up in line 69.
Last edited on
Hey thanks!
I guess I forgot to give the type when calling the function. It compiles just fine now. Apologies for just slapping an error code up there without the text that comes with it. At least it's better than my last post... (I didn't know how to get the code come out looking like code on the post). I feel dumber and dumber every time I find the answer to my question here.

"If you wish to improve, be content to be though foolish and stupid" -Epictetus

Thanks Again!
Topic archived. No new replies allowed.