Array Assistance-Not Printing, Passing Values from Function

This is probably another very simple error on my part, but for the life of me I cannot figure out what I'm doing wrong.

My array prints on its own (when I remove the rest of the code) without the values passed from the function, but it does not print with the added values. This is for a seating chart program, where available seats are meant to print as # symbols and taken seats are meant to print as * symbols.

I've tried locally changing the values to integers (display [2] [2]=taken;) for example, and it does print those.

As is, with my functions included, it isn't printing my array at all-which leads me to believe that there's an issue with my function call but I don't see it. Any assistance would be greatly appreciated, thank you so much!!

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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
 #include <iostream>
#include <iomanip>



//function prototype storing seat choices
int getSeatChoice ();
//function prototype storing row choice
int getRowChoice ();


using namespace std;

int main  ()

{
	
const int SEATS=30;
const int ROWS=15;
char available='#';
char display [ROWS][SEATS]; 
char taken='*';
int rowChoice;
int seatChoice;


{

	for (int j=0; j<ROWS; j++)
	{
	
		for (int k=0; k<SEATS; k++)
		{
		getRowChoice();
		getSeatChoice();
		
		cout<<setw(17)<<"Seats"<<endl;	
		display [j][k]=available;
		display[rowChoice][seatChoice]=taken;
		cout<<display[j][k]<<"";
		cout<<"\n";
	}
}




	
}


	return 0;


	

}


int getSeatChoice ()
{

int seatChoice=0;
int seatHolder=0;

cout<<"Which seat would you like to sit in?";
cin>>seatHolder;
seatChoice=(seatHolder-1);




return (seatChoice);
}


int getRowChoice ()

{
	
int rowChoice=0;
int rowHolder=0;	
cout<<"Which row would you like to be seated in? ";
cin>>rowHolder;
rowChoice=(rowHolder-1);


return (rowChoice);
}



In function 'int main()':
39:39: warning: 'rowChoice' may be used uninitialized in this function [-Wmaybe-uninitialized]
39:39: warning: 'seatChoice' may be used uninitialized in this function [-Wmaybe-uninitialized]

Did you see messages like this?

You're calling functions which return values, but you're just ignoring those values.
1
2
rowChoice = getRowChoice();
seatChoice = getSeatChoice();
I don't-in my IDE the program compiles and runs, it just doesn't print the array. I'm required to use DevC++, and while we just send the source code to our professor I try to follow her instructions...but the few actual programmers I've had contact with don't seem to like DevC++ and I'm guessing this is one of the reasons why.

Thank you so much for the feedback! That's really helpful, I can't thank you enough!
If it's this dev-c++, then you should be able to add the "-Wall" option in your project settings.
https://sourceforge.net/projects/orwelldevcpp/

If you've got the bloodshed version of dev-c++, then you have a misguided tutor.
It's been obsolete for 15 to 20 years.
I have the bloodshed version :-/ It's what was recommended by the professor.
I imagine you can turn on warnings even in the old version of Dev-C++, no?
Try looking in the Compiler settings for an option to enable them, it's worth a shot.
Ask your professor about modern C++.
https://en.wikipedia.org/wiki/C%2B%2B#Standardization

Ganado, thanks for your help! I was able to turn them on once I looked around a bit.

Salem, will do! I *think* what my professor likes about this version of DevC++ is that you have to type in every character (no suggestions, etc.), which causes you to be careful. Can't say for sure, I'm not experienced enough to pretend I could talk about IDEs (as my handle says-I have a lot to learn!), but I will ask. Thanks again for your help!!
Topic archived. No new replies allowed.