how can i do this ?
the error was lvalue required.

#include<iostream.h>
#include<sting.h>
#include<conio.h>
#include<stdio.h>
struct movies_t {
	char title[50];
	int year;
	} mine, yours;

void printmovie (movies_t movies_t);

main ()
{
clrscr();
struct movies_t mine, yours;
mine.title="The Curious Case of Benjamin Button";
mine.year=2008;

cout<<"Enter title:";
gets(yours.title);

cout<<"Enter year:";
cin>>yours.year;

cout<<"My Favorite movie is:<<endl";
printmovie (mine);
cout<<"And yours is:\endl";
printmovie (yours);
getch();
return 0;
}
void printmovie (movies_t movie)
{
cout<<movie.title;
cout<< " ("<<movie.year<<")\n";
}

Tnx

You can not copy strings with the assignment operator. Try using strcpy to set the title to "The Curious Case...". You can only use a constant string when initializing arrays.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.