Why wont my program cout?

Hello any idea why I don't get any output?
Thanks in advance

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

#include <iostream>

using namespace std;

struct movieData{
	char title[30];
	char name[30];
	int year;
	int lenth;
};

void output(movieData);
int main()
{
	movieData movie1 = {"Transformers", "Michael Bay", 2007, 144};
	void output(movieData movie1);

	system("PAUSE");
	return 0;
}

void output(movieData movie1)
{
	cout << movie1.title;

}
closed account (o3hC5Di1)
Hi there,

When you call a function, you don't need to specify its return type:

void output(movieData movie1); //line 17

Hope that helps.

All the best,
NwN
can you use strings instead of char types?
and when you call a function, you don't have to specify its variable type:
void output(movieData movie1);


i can suggest to you an example:

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
//OutputStruct.cpp
//Get some output

#include <iostream>
using std::cout;
using std::cin;
using std::endl;

#include <string>
using std::string;


struct MovieData{
	string title;
	string name;
	int year;
	int length;

};//end struct MovieData

void Output(MovieData movie); //function prototype

int main(){

MovieData movie1={"Transformers","Michael Bay",2007,144};

Output(movie1);

cin.ignore();

return 0; //indicates success
}//end main

void Output(MovieData movie){

	cout<<movie.title<<'\n'
		<<movie.name<<'\n'
		<<movie.year<<'\n'
		<<movie.length<<'\n'<<endl;
}//end function Output



Eyenrique-MacBook-Pro:Help Eyenrique$ ./OutputStruct 
Transformers
Michael Bay
2007
144
Topic archived. No new replies allowed.