I am new to C++ I recently been trying to write an Game data base in C++ but I succesed in nothing though the Code seem to be all right it always shows me error messages

this is the Source Code i created for this program:

#include<iostream.h> 
#include<conio.h> 
#define max 1000 
//------------------------------------------------------------------------------ 
struct moto{ 
char gra[10]; 
rodzaj[10];
int rok_produkcji; 
}; 
moto game[max];
void main() 
{
clscr();
cout<<"Podaj liczbę Gier których dane chcesz wprowadzic:\n";(from Polish Users message:How many Games you wish to type  in ?)
int n; 
cin>>n; 
for(int i=0; i<n;++)
{
cout<<"\n\n Podaj nazwe ",, i+1<<"gry:"; (Users Message: Please write the title)
cin>>game[i].gra; 
cout<<"\n podaj rodzaj"<<i+1<<"gry:"; (Users Message Type of game)
cin>>game[i].rodzaj; 
cout<<"\n podaj rok produkcji" <<i+1<<"gry:"; (Users message: Publication Year)
cin>>game[i].rok_produkcji; 
}
cout<<"\n\n wybierz opcje:\n";(Users Message Please pick an option)
cout<<"1. szukanie wedlug nazwy gry:\n";(Searching by Name )
cout<<"2.Szukanie wedlug daty produkcji:\n";(searching by date)
int opcja 
cin>>opcja; 
switch(opcja) 
{ 
case 1:cout<<"Podaj nazwe gry:\n"; (write name of the game)
char name[10]; 
cin>>name; 
clscr() 
for(i=0;<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"; (Type in Year of Publication)
int rok;
cin>>rok; 
clscr();
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"; (Choose 1 or 2)*
} 
getch(); 
}

Evrytime I start the compilator it shows me this error messages:


[C++ error]Unit1.cpp(9)Type name expected
-II- Unit1.cpp(15)Call to undefined function 'clscr'
Unit1.cpp(19)Expresion Syntax
Unit1.cpp(28)For statement missing
Unit1.cpp(32)Declaration Syntax error
Unit1.cpp(39)Statement missing
Unit1.cpp(39)Expresion syntax
Unit1.cpp(39)Statement missing
Unit1.cpp(46)Break Statement missing
Unit1.cpp(53)Undefined symbol rok_produkcji (It is there so why it dosent se it?)
Unit1.cpp(56) Break statement missing
* Note: Translation werent in the original code I placed them assuming you Dont know Polish (im from Poland)

Basically Thats was my Idea but I made some mistake could you write me a Gamedatabase based on this idea or just rewrite my Source code so It will compile and start working ........Also What does error mean coul you please take a time and explain it to me I am an amateur and I just dont get it what that Compilator wants Im working on (C++Builder 6 from Borland) I thought that the Source code was right PLEASE ANSWER ME !!!!!

#include<iostream.h> 
#include<conio.h> 
#define max 1000 
//------------------------------------------------------------------------------ 
struct moto{ 
char gra[10]; 
rodzaj[10];
int rok_produkcji; 
}; 
moto game[max];
void main() 
{
clscr();
cout<<"Podaj liczbę Gier których dane chcesz wprowadzic:\n";(from Polish Users message:How many Games you wish to type  in ?)
int n; 
cin>>n; 
for(int i=0; i<n;++)
{
cout<<"\n\n Podaj nazwe ",, i+1<<"gry:"; (Users Message: Please write the title)
cin>>game[i].gra; 
cout<<"\n podaj rodzaj"<<i+1<<"gry:"; (Users Message Type of game)
cin>>game[i].rodzaj; 
cout<<"\n podaj rok produkcji" <<i+1<<"gry:"; (Users message: Publication Year)
cin>>game[i].rok_produkcji; 
}
cout<<"\n\n wybierz opcje:\n";(Users Message Please pick an option)
cout<<"1. szukanie wedlug nazwy gry:\n";(Searching by Name )
cout<<"2.Szukanie wedlug daty produkcji:\n";(searching by date)
int opcja 
cin>>opcja; 
switch(opcja) 
{ 
case 1:cout<<"Podaj nazwe gry:\n"; (write name of the game)
char name[10]; 
cin>>name; 
clscr() 
for(i=0;<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"; (Type in Year of Publication)
int rok;
cin>>rok; 
clscr();
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"; (Choose 1 or 2)*
} 
getch(); 
}

Line 2 - there's a whole bunch of threads around here about why not to use conio.h.
Line 11 - main should return an integer. "void main" has problems.
Line 13 - I think "clscr" is a Borland-specific function.
Line 14 - Are the words outside of the quotes to be displayed? If so, put them inside the quotes. If they are comments, you need to put // in the code to show they are comments. I'm assuming this isn't actually in the code but are just translations for our benefit. Denote them as comments with //
Line 17 - ++ What are you incrementing, i?
Lines 21, 23, and others - see comment for line 14.
Line 43: Semicolon?
Line 56: "getch" is another compiler-specific function, I think. Try "getchar".

Thanks for using code tags!

If you are going to continue with your coding career you will need to learn how to handle error messages from your compiler. Usually tackle the first one or two and recompile. Often a number of the remainder will go away, though sometimes new ones will appear too!

In this case the first error message probably means that clscr() isn't a function in either of the header files you've included and isn't a user defined function. I think you want clrscr() which is in conio.h, I believe.

The second error message probably has to do with this line:
for(int i=0; i<n;++)
which should probably be this:
for(int i=0; i<n;++i)
though I won't gaurantee that.

I wouldn't even begin to tackle the remainder wihtout recompiling after dealing with both of those.

Also, iostream.h isn't the prefered header file for I/O in C++ any longer, it's iostream and a line like:
using namespace standard;

In addition, void main() may be allowed by some compilers but it was never the correct way, which is:

int main()

#include<iostream>
#include<conio>
#define max 1000 
//------------------------------------------------------------------------------
 using namespace standard;

struct moto{ 
char gra[10]; 
rodzaj[10];
int rok_produkcji; 
}; 
moto game[max];
 int main()
{
clrscr();
cout<<"Podaj liczbę Gier których dane chcesz wprowadzic:\n";
int n; 
cin>>n; 
for(int i=0; i<n;++)
{
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();
}

As You See I Adapted this like You Said But Still It Does senm me some Error theyre diffrent This time Thought Can You Please Check it To see if I made any grammar Error in this

These are the Error message which it showed to me:
Cpp(5) Namespace expected
Cpp(9) Type Name expexted
Cpp(16) Undefined symbol Cout
Cpp(18)Undefined Symbol Cin
Cpp(19)Expresion Syntax
Cpp(28) For Statement missing]
Cpp(32) declaration Syntax Error
Cpp(39) Statement Missing;
Cpp(46)Break Statement Missing;
Cpp(53)undefined symbol rok_produkcji
Cpp(56) Break Statement missing;

Some errors seem to be just simple grama errors!!! Could you please Check on them and write whats wrong this time im also gonna try resolve this problem on my own however if I will not be able to fix it Ill check here to see what I made wrong THNX

Try changing the line

using namespace standard;

to

using namespace std;

May not make any difference, but give it a try.

Also, since you've changed it to "int main" from "void main", make sure you have the line:

return 0;

at the end of the main function.

And I think (though I'm not positive) that if you decide to use conio (again, check out the threads about why this is potentially a bad idea), you need to call it "conio.h", not "conio". But keep "iostream" as "iostream" rather than "iostream.h".

You Were Right it really worked it only shows me few error message i figured out some of the gramma errors it also help
I cant Run the programm yet may you see whats wrong yet:

#include<iostream>
#include<conio.h>
#define max 1000 
//------------------------------------------------------------------------------
   using namespace std;

struct moto{ 
char gra[10]; 
rodzaj[10];
int rok_produkcji; 
}; 
moto game[max];
 int main()
   return 0;
{
clrscr();
cout<<"Podaj liczbę Gier których dane chcesz wprowadzic:\n";
int n; 
cin>>n; 
for(int i=0; i<n;++)
{
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();
}

And these Error messages are:
Cpp(9) Type name expected (what does he mean by Type name is there something I missed out)
Cpp(14)Declaration Syntax error
Cpp(15) Declaration terminated Incorrectly

What Did I wrong it seems to work if only I knew why he given me these messages

By the Way how did You made these Numbers in Code I would like to know that ?

Someone said use

paste ur code here

[/  code]

but make sure that there is no space between "code", "=" and "cplusplus" same goes to

By the Way how did You made these Numbers in Code I would like to know that ?

To get the line numbers and code-coloring use [code=cplusplus] your code here [/code] tags

The first error the compiler gives you is about this line rodzaj[10]; (line 9)
You didn't give it a type. Is it an int, char, long, double, ...

The second/third error is this line: return 0; It was placed at the wrong place, it should go at the bottom of main. :

int main()
{
  //your code
  return 0;
}

Do you know how to use functions?

Niek

The first error the compiler gives you is about this line rodzaj[10]; (line 9)
You didn't give it a type. Is it an int, char, long, double, ...

said niek_e can somebody care to explain what he meant ?

#include<iostream>
#include<conio.h>
#define max 1000 
//------------------------------------------------------------------------------
   using namespace std;
  int main()
  (
struct moto{
char gra[10];
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;++)
{
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;
}

Also Thiese are another Error Statements:

Cpp(7) Declaration Syntax Error
Cpp(13) Declaration Syntax error
Cpp(16) Declaration terminated incorrectly

said niek_e can somebody care to explain what he meant ?

Compare lines 9 and 10 in your code:

#include<iostream>
#include<conio.h>
#define max 1000 
//------------------------------------------------------------------------------
   using namespace std;
  int main()
  (
struct moto{
char gra[10];
rodzaj[10];

What is the data type of rodzaj? It is an array, but an array of what? Characters, integers, floats? In line 9, you declare an array of characters called gra. If rodzaj is an array of characters, line 10 needs to be:

char rodzaj[10];

If it's an array of integers, it needs to be:

int rodzaj[10];

If it's something else, replace "int" with the type that rodzaj is.

You also need semicolons after your "break" commands.

If my eyes aren't deceiving me line 7 looks like a parenthesis, (, instead of an opening curly brace, {.

#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;++)
(
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;
)

If my eyes aren't deceiving me line 7 looks like a parenthesis, (, instead of an opening curly brace, {.

SAID Lerner

I think it should be a parenthesis I Did change it to Openly Curly brace but that only worsen the situation I think the compilator wants it to be writen that way it only shows me onw Error now:

Cpp(7) Declaration Syntax Error

main() is a function, though it has some restrictions associated with it. For example, it should never have a return type other than main. It can only have 0 or two parameters (if it's written without parameters I believe the two are implied anyway by the compiler). It needs to have an opening curly brace and a closing curly brace.

Line 12 should be a closing curly brace, not a closing parenthesis, followed by a semicolon.

Line 16 is superfluous.

Line 22 should be an opening curly brace and line 29 should be a closing curly brace.

Line 36 should be an opening curly brace and line 59 should be a closing curly brace.

Line 62 should be a closing curly brace.

The semicolon at the end of line 41 means the for loop is just spinning it's wheels with doing anything meaningful.

There should be semicolon at the end of line 33.

I think I'll stop there for now though there are others, such as using curly braces with case statements if any variable is declared within the case statement.

#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;++)
}
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 These are the Error Messages the compilator send me:

cpp(7)Declaration Syntax Error
cpp(13)Declaration Syntax Error
cpp(17) ) Expected 
cpp(18) Declaration Syntax Error
cpp(20) Declaration Syntax Error
cpp(21) Declaration terminated incorrectly
cpp(21) Declaration syntax Error
cpp(22) Unexpected )
cpp(23) ambiguity beetween cout ans _Stl::cout
cpp(23) Multiple declaration for Cout
cpp(18) Earlier declaration of cout
cpp(23) Declaration Syntax error
cpp(24) Ambiguity between cin ands _Stl::cin
cpp(24) Multiple declaration for cin
cpp(20) Earlier declaration of cin
cpp(24) Declaration syntax Error
cpp(25) ambiguity beetween cout ans _Stl::cout
cpp(25)Multiple declaration for cout
cpp(23) earlier declaration of cout
cpp(25) declaration syntax error
cpp(26) Ambiguity between cin ands _Stl::cin
cpp(26) Multiple declaration for cin
cpp(24)earlier declaration of cin
cpp(24) To many error mesages 

now IM IN SCHOCK !!!
PLZ HELP

now IM IN SCHOCK !!!

Me too

In line 21 ur for loop statement u need to have i++ not just ++... U cant have for loop and close the braces without opening them(Line 22).... In line 23 delete one of the commers..... In line 40 u need to close ur clrscr() statement and have this clrscr();..... In line 43 fix ur new line but thats not the reason of error just changed it to "/n/n" instead of "n/n" and again in line 43 u dont need a space between game and ur array game .... if there are statements that are part of the forloop u need to have ur braces open and close (eg) {ur exetuted statement} to determine which statements must be executed within the forloop.... alwayz sermi-colons after break (i.e) break;

It still seems to be getting worser and worser

well

#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 compilator shows me these messages now:

cpp(7) Declaration Syntax Error
cpp(13) Declaration Syntax Error
cpp(17) ) expected
cpp(18) Declaration Syntax Error
cpp(20) Declaration Syntax Error
cpp(21) Declaration terminated incorrectly
cpp(21) Declaration syntax error
cpp(21) Multiple declaration for "i"
cpp(21) Earlier declaration of "i"
cpp(21) Declaration Syntax Error
cpp(22) Unexpected )
cpp(22) Unexpeted )
cpp(23) Ambiguity between cout and STL::cout
cpp(23)  Multiple declaration for cout
cpp(18) Earlier declaration of cout
cpp(23) Declaration Syntax Error
cpp(24) Ambiguity between cin and STL::cin
cpp(24) Multiple declaration for cin
cpp(20) Earlier declaration of cin
cpp(24) Declaration syntax error
cpp(25) Ambiguity between cout and STL::cout
cpp(25) Multiple Declaration for cout
cpp(23) Earlier declaration  of cout
cpp(25)  Declaration Syntax Error
cpp(26)Ambiguity between cin and STL::cin
cpp(26) To many error messaages

You still refuse to change int main() ( to int main() { Because of this error the other messages don't really make sense.

Niek

Tnkhx Nieek I really didnt noticed that

Now Things really did Improve it only has 13 error messgages now

Heres the source code again::)

#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;
)

Now the Compilator shows me only thirteen Error Messages:

cpp(8) Expresion Syntax
cpp(13) undefined symbol moto
cpp(13) Statement mising;
cpp(17) ) Expected
cpp(22) statement missing;
cpp(23) undefined symbol "i"
cpp(24) Undefined symbol"game"
cpp(29) expresion syntax
cpp(42) call to undefined function stremp
cpp(55) undefined symbol rok_produkcji
cpp(62) W8066  Unreachable code
cpp(62) expresion Syntax
cpp(62) Compound statement missing )

make it eleven (sorry for that but there is only eleven statements on the Error list my baaad

Tnkhx Nieek I really didnt noticed that

Now Things really did Improve it only has 13 error messgages now

Heres the source code again::)

#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;
)

Now the Compilator shows me only thirteen Error Messages:

cpp(8) Expresion Syntax
cpp(13) undefined symbol moto
cpp(13) Statement mising;
cpp(17) ) Expected
cpp(22) statement missing;
cpp(23) undefined symbol "i"
cpp(24) Undefined symbol"game"
cpp(29) expresion syntax
cpp(42) call to undefined function stremp
cpp(55) undefined symbol rok_produkcji
cpp(62) W8066  Unreachable code
cpp(62) expresion Syntax
cpp(62) Compound statement missing )

end quote.

Get rid of the open parentheses on line 7. You needed to REPLACE it with a {, not add the the { and keep the ( too. If you have a closing ) to match the opening (, delete it too. looks like you have the same thing happening on line 16. Delete that (. Traicey pointed out the problem in line 22. It's still there. Start at the top, fix the first error, then recompile,. Then look at the new first error after recompiling, fix that, recompile, etc. Don't try to fix all the errors at once. And read the posts. Some things had been pointed out in earlier posts that weren't fixed.

So Basicaly What youre trying to get throught to is that that only first two error messages really matter .....it seems youre right the others seem to change hm so thats how it is !!

All right I got it I read all the posts there were in fackt lines I missed my bad I think I gottem them all thought it still has some problems :

[code = cplusplus]
   #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;
)
}
  [/ code]

Im still gonna write all Error Mesages I got:
cpp(24) Undefined symbol "i"
cpp(30) expression Syntax
cpp(43)call to undefined function stremp
cpp(56) undefined symbol rok_produkcji
cpp(63) W8066 Unreachable code
cpp(63) Expresion Syntax
cpp(64) Statement missing;

Ok you said first one is Important so please tell me what i Have to do to fix Cpp 24
also whats wrong with cpp 43, cpp 56 ,cpp 63 and cpp 64

in my opinion these are the critical messages

You've got you loop wrong: for(int i=0; i<n;i++); The semicolon makes the loop do nothing until i == n

The right way would be something like:

for(int i=0; i<n;i++) // <--- NO semicolon
{
    //do something here
}

Niek

So Basicaly What youre trying to get throught to is that that only first two error messages really matter .....it seems youre right the others seem to change hm so thats how it is !!

All right I got it I read all the posts there were in fackt lines I missed my bad I think I gottem them all thought it still has some problems :


Help with Code Tags (Toggle Plain Text)

[code=cplusplus]
   #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;
)
}

    [/ code]

Im still gonna write all Error Mesages I got:
cpp(24) Undefined symbol "i"
cpp(30) expression Syntax
cpp(43)call to undefined function stremp
cpp(56) undefined symbol rok_produkcji
cpp(63) W8066 Unreachable code
cpp(63) Expresion Syntax
cpp(64) Statement missing;

Ok you said first one is Important so please tell me what i Have to do to fix Cpp 24
also whats wrong with cpp 43, cpp 56 ,cpp 63 and cpp 64

in my opinion these are the critical messages

You've got you loop wrong:
for(int i=0; i<n;i++);
The semicolon makes the loop do nothing until i == n

I changed it like Nieek told me too the only thing changed was this Error message witch came out first:
cpp(24) ilegal use of pointer
the rest is in my previous post

I changed it like Nieek told me too the only thing changed was this Error message witch came out first:
cpp(24) ilegal use of pointer
the rest is in my previous post

You aren't using pointers. Where did you put the brackets? I DO see something wrong in line 24:

cout<<"\n\n Podaj nazwe ", i+1<<"gry:";

You have a comma in there. Is it supposed to be << ? Change it and see if the error goes away. If not, repost the code, or at least repost the code for that for-loop.

Yes it helped

#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;
)
}

The Eror messages are :

cpp(25) Undefined symbol "i"
cpp(30) expression Syntax
cpp(43)call to undefined function stremp
cpp(56) undefined symbol rok_produkcji
cpp(63) W8066 Unreachable code
cpp(63) Expresion Syntax
cpp(64) Statement missing;

You have a brackets problem here:

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;
 )

Also, again, don't confuse ) and }. Check out this link and the first several posts on it regarding how a compiler treats for-loops and if-statements with no brackets, as well as "scope" issues.
http://www.daniweb.com/forums/post566372.html#post566372

Emm What exacly did you meant by stating

You have a brackets problem here:

VernonDozier

What are "brackets" i dont understand I read the Post you said but I didnt get that what are "brackets" ?

Emm What exacly did you meant by stating
VernonDozier

What are "brackets" i dont understand I read the Post you said but I didnt get that what are "brackets" ?

These are brackets: { and }
These are parentheses: ( and )

Brackets are used to denote the start and end of blocks of code. Use them to show where an if statement, for-loop, or while-loop starts and ends. Don't use parentheses. Use parentheses to denote the start and end of the parameters that you are passing to a function or the expression to be evaluated in an if statement or the conditions in a for loop:

for (int i = 0; i < 10; i++)  // parentheses
{  // starting bracket
     cout << i << endl;  // code to be repeated is INSIDE brackets
} // ending bracket
// i no loger exists when you get here.
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.