carlosA
Fragment kodu:
struct Ksiazka {
char autor[50];
char tytul[50];
int LiczbaStron;
int wydanie;
double cena;
void wyswietl();
};
//spis procedur umożliwiających wykonanie działań na bazie danych
int zapis();
int odczyt();
int z_plik();
int szukaj();
int zasadniczy();
//void Ksiazka::wyswietl() {
// cout << "Autor: " << autor << endl;
// cout << "Tytul: " << tytul << endl;
// cout << "Liczba stron: " << LiczbaStron << endl;
// cout << "Wydanie: " << wydanie << endl;
// cout << "Cena: " << cena << endl;
// }
void f_autor( char find_autor, Ksiazka* where, int ile_rekordow ){
cls();
for( int i = 0; i < ile_rekordow; i++ ) //36
if( find_autor == where[i].autor ) //37
cout << where[i].autor << endl; //38
cout << where[i].tytul << endl; //39
cout << where[i].LiczbaStron << endl;
cout << where[i].wydanie << endl;
cout << where[i].cena << endl;
cout << "\n" << endl;
}
Błędy:
37 ISO C++ forbids comparison between pointer and integer
39 name lookup of `i' changed for new ISO `for' scoping
36 using obsolete binding at `i'
Pewnie coś czeskiego, bo patrzyłem na gotowca i coś źle przerobiłem, ale siedzę gapię się, jak małpa w gnat.
Korzystałem na podstawie takiego przykładu:
struct osoba {
string imie;
string nazwisko;
int id;
};
void find_name( string name, osoba* where, int ile_osob ){
for( int i = 0; i < ile_osob; i++ )
if( name == where[i].imie )
cout << where[i].id << ". " << where[i].imie << ' ' << where[i].nazwisko << '\n';
}
void find_surname( string surname, osoba* where, int ile_osob ) {
for( int i = 0; i < ile_osob; i++ )
if( surname == where[i].nazwisko )
cout << where[i].id << ". " << where[i].imie << ' ' << where[i].nazwisko << '\n';
}
i tutaj wszystko jest ok.
Jakieś sugestie?
struct Ksiazka {
char autor[50];
char tytul[50];
int LiczbaStron;
int wydanie;
double cena;
void wyswietl();
};
//spis procedur umożliwiających wykonanie działań na bazie danych
int zapis();
int odczyt();
int z_plik();
int szukaj();
int zasadniczy();
//void Ksiazka::wyswietl() {
// cout << "Autor: " << autor << endl;
// cout << "Tytul: " << tytul << endl;
// cout << "Liczba stron: " << LiczbaStron << endl;
// cout << "Wydanie: " << wydanie << endl;
// cout << "Cena: " << cena << endl;
// }
void f_autor( char find_autor, Ksiazka* where, int ile_rekordow ){
cls();
for( int i = 0; i < ile_rekordow; i++ ) //36
if( find_autor == where[i].autor ) //37
cout << where[i].autor << endl; //38
cout << where[i].tytul << endl; //39
cout << where[i].LiczbaStron << endl;
cout << where[i].wydanie << endl;
cout << where[i].cena << endl;
cout << "\n" << endl;
}
Błędy:
37 ISO C++ forbids comparison between pointer and integer
39 name lookup of `i' changed for new ISO `for' scoping
36 using obsolete binding at `i'
Pewnie coś czeskiego, bo patrzyłem na gotowca i coś źle przerobiłem, ale siedzę gapię się, jak małpa w gnat.
Korzystałem na podstawie takiego przykładu:
struct osoba {
string imie;
string nazwisko;
int id;
};
void find_name( string name, osoba* where, int ile_osob ){
for( int i = 0; i < ile_osob; i++ )
if( name == where[i].imie )
cout << where[i].id << ". " << where[i].imie << ' ' << where[i].nazwisko << '\n';
}
void find_surname( string surname, osoba* where, int ile_osob ) {
for( int i = 0; i < ile_osob; i++ )
if( surname == where[i].nazwisko )
cout << where[i].id << ". " << where[i].imie << ' ' << where[i].nazwisko << '\n';
}
i tutaj wszystko jest ok.
Jakieś sugestie?
#whatever
