For some reason, CodeBlocks is giving me errors for this code:
Here are my errors (in color coding)
Line 7: error: variable 'movies t' has initializer but incomplete type
Line 7: warning: extended initializer lists only available with -std=C++0x or -std=gnu++0x [enabled by default]
Line 8: error: expected primary-expression before 'title'
Line 8: error: expected '}' before 'title'
Line 8: error: expected ',' or ';' before 'title'
Line 10: error: expected declaration before '}' token
Can someone please give me a link or something that will help fix these problems.
My C++ IDE is CodeBlocks and i'm running Windows 7 64-bit edition
Code:
// example about structures
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
struct movies t {
string title;
int year;
} mine, yours;
void printmovie (movies t movie);
int main ()
{
string mystr;
mine.title = "2001 A Spce Odeyssey";
mine.year = 1968;
cout << "Enter title: ";
getline (cin,yours.title);
cout << "Enter year: ";
getline (cin,mystr);
stringstream(mystr) >> yours.year;
cout << "My favourite movie is:
";
printmovie (mine);
cout << "And your is:
";
printmovie (yours);
return 0;
}
void printmovie (movies_t movie)
{
cout << movie.title;
cout << " (" << movie.year << ")
";
}
// end of line
Here are my errors (in color coding)
Line 7: error: variable 'movies t' has initializer but incomplete type
Line 7: warning: extended initializer lists only available with -std=C++0x or -std=gnu++0x [enabled by default]
Line 8: error: expected primary-expression before 'title'
Line 8: error: expected '}' before 'title'
Line 8: error: expected ',' or ';' before 'title'
Line 10: error: expected declaration before '}' token
Can someone please give me a link or something that will help fix these problems.
My C++ IDE is CodeBlocks and i'm running Windows 7 64-bit edition