0

Line 23 should be {
Line 29 should be }
Line 38 should look like this:
case 1:{cout<<"Podaj nazwe gry:\n";
Line 47 should be }
You need similar changes for case 2 to those I made for case 1.
Delete line 63

0

I read all post thnx for Information it only has three error this time:

#include<iostream>
#include<conio.h>
#define max 1000
//------------------------------------------------------------------------------
   using namespace std;
       int main()
       {

struct moto{
char gra[10];
char rodzaj[10];
int rok_produkcji;
};
moto game[max];



clrscr();
cout<<"Podaj liczbę Gier których dane chcesz wprowadzic:\n";
int n;
cin>>n;
for(int i=0; i<n;i++)
{
cout<<"\n\n Podaj nazwe "<<i+1<<"gry:";
cin>>game[i].gra;
cout<<"\n podaj rodzaj"<<i+1<<"gry:";
cin>>game[i].rodzaj;
cout<<"\n podaj rok produkcji" <<i+1<<"gry:";
cin>>game[i].rok_produkcji; {
 }
cout<<"\n\n wybierz opcje:\n";
cout<<"1. szukanie wedlug nazwy gry:\n";
cout<<"2.Szukanie wedlug daty produkcji:\n";

int opcja;
cin>>opcja;
switch(opcja)
{
case 1:{cout<<"Podaj nazwe gry:\n";
char name[10];
cin>>name;
clrscr();
 for(int i=0; i<n;++i)
if(stremp(name,game[i].gra)==0)
cout<< "/n/n" <<game[i].gra<<""<<
game[i].rodzaj
<<"\n rok produkcji"<<game[i].rok_produkcji;
  }
break;
case 2:{cout <<"podaj rok produkcji gier:\n";
int rok;
cin>>rok;
clrscr();
for (i=0; i<n;i++)
if(rok==game[i].rok_produkcji)
cout<<"n\n" << game[i].gra<<game[i] <<
rok_produkcji;
 }
break;
default:cout<<"Podaj numer 1 lub 2";
}
getch();
  return 0;
  }
  }

and the error messages are:

cpp(44) call to undefined function stremp
cpp(56) operator not implemented in type ostream for arguments of type moto
cpp(57) undefined symbol rok_produkcji

Edited by mike_2000_17: Fixed formatting

0

He meant that

struct moto{
char gra[10];
rodzaj[10];
int rok_produkcji;
};

should be
struct moto{
char gra[10];
char rodzaj[10];
int rok_produkcji;
};

0

Line 44) stremp is probably a typo for strcmp

Line 56)To output a user defined type the compiler needs to know what to do. game is of type moto, a user defiined type. When displaying an object of type moto do you want to display one or more of the member variables contained with each moto object or do you want to print a copy of the Wisconsin Administrative Building Code? Once you've figured out what you want to display, then either declare and define a member function called something like display() or overload the << to do what you want.

Line 57) rok_produkcji does not exist as a free standing variable. It only exists as a member variable of an object of type moto. Therefore, the only way you can send it to an ostream method/operator is to send it as an object member, say game.rok_produkcji by removing the << between game on line 56 and rok_produkcji on line 57.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.