h.....a konto usunięte 05.04.2017, 18:05:08 1 #include #include #include using namespace std;int liczba;struct car{ string marka; int rok;};int main(){ cout<<"Ile samochodow chcesz skatalogowac? "; cin>> liczba; car *carstruct = new car [liczba]; for (int i = 0 ; i< liczba; i++) { cout<<"Samochod "<>carstruct[i].marka; //getline(cin , carstruct[i].marka); cout<<"Rok produkcji: "; cin>>carstruct[i].rok; } for (int j = 0 ; j < liczba ; j++ ) { cout< Cronox
Hirunkan Hirunkan 05.04.2017, 18:12:01 2 @hanyska: cin wczytuje tylko do spacji, musisz użyć getline (tak jak masz zakomentowane). Tylko wtedy nie powinnaś mieszać z cin. szasznik nicniezgrublem
Hirunkan Hirunkan 05.04.2017, 18:19:55 0 @hanyska: Jeśli jednak koniecznie chcesz korzystać naprzemiennie z cin i getline to spróbuj wywołać cin.ignore(); po każdym użyciu cin
h.....a konto usunięte 05.04.2017, 18:36:19 0 #include #include #include using namespace std;int liczba;struct car{ string marka; int rok;};int main(){ cout<<"Ile samochodow chcesz skatalogowac? "; cin>> liczba; car *carstruct = new car [liczba]; for (int i = 0 ; i< liczba; i++) { cout<<"Samochod "<>carstruct[i].rok; } for (int j = 0 ; j < liczba ; j++ ) { cout<
#include
#include
using namespace std;
int liczba;
struct car
{
string marka;
int rok;
};
int main()
{
cout<<"Ile samochodow chcesz skatalogowac? ";
cin>> liczba;
car *carstruct = new car [liczba];
for (int i = 0 ; i< liczba; i++)
{
cout<<"Samochod "<>carstruct[i].marka;
//getline(cin , carstruct[i].marka);
cout<<"Rok produkcji: ";
cin>>carstruct[i].rok;
}
for (int j = 0 ; j < liczba ; j++ )
{
cout<
#include
#include
using namespace std;
int liczba;
struct car
{
string marka;
int rok;
};
int main()
{
cout<<"Ile samochodow chcesz skatalogowac? ";
cin>> liczba;
car *carstruct = new car [liczba];
for (int i = 0 ; i< liczba; i++)
{
cout<<"Samochod "<>carstruct[i].rok;
}
for (int j = 0 ; j < liczba ; j++ )
{
cout<