4.06.2014 / 15:38 |  | 
Freddy    Пользователь  
   Сейчас: Offline 
 Имя: Игорь Откуда: Воронеж Регистрация: 30.01.2010
   | Gaucer, у тебя есть указатель на структуру который ни на какую-либо структуру не указывает, поэтому данными из потока cin ничто не заполняется. Исправил: Открыть спойлер Закрыть спойлер #include <iostream>  
#include <stdio.h>  
#include <string.h>  
#include <stdlib.h>  
   
using namespace std;  
   
class Match {  
public:  
    struct _table {  
       char team1[50], team2[50], time[5], date[5], stadium[50];  
    };  
   
    struct _table *tab = (struct _table *)malloc(sizeof(struct _table));  
   
    void h_team() {  
        cout << "Enter home team: ";  
        cin.getline(tab->team1, 50);  
        //cout << tab->team1 << endl;  
    }  
    void g_team() {  
        cout << "Enter guest team: ";  
        cin.getline(tab->team2, 50);  
        //cout << tab->team2 << endl;  
    }  
    void date() {  
        cout << "Enter date of the match (30/12): ";  
        cin.getline(tab->date, 6);  
        //cout << tab->date << endl;  
    }  
    void time() {  
        cout << "Enter time of the match (00:00): ";  
        cin.getline(tab->time, 6);  
        //cout << tab->time << endl;  
    }  
    void stad() {  
        cout << "Enter stadium: ";  
        cin.getline(tab->stadium, 50);  
        //cout << tab->stadium << endl;  
    }  
    void print() {  
        perror("Program returns");  
        cout << tab->team1 << " - " << tab->team2 << ", " << tab->date << ", " << tab->time << ", " << tab->stadium;  
    }  
   
};  
   
int main() {  
    Match One;  
    One.h_team();  
    One.g_team();  
    One.date();  
    One.time();  
    One.stad();  
    One.print();  
   
    return 0;  
}  
  Изменено Freddy (4.06 / 15:39) (всего 1 раз) | 
  4.06.2014 / 19:10 |  | 
Gaucer    Пользователь  
   Сейчас: Offline 
 Имя: Денис Регистрация: 23.04.2012
   | Freddy, отблагодарил)
   | 
  4.06.2014 / 21:58 |  | 
Gaucer    Пользователь  
   Сейчас: Offline 
 Имя: Денис Регистрация: 23.04.2012
   | и снова я! надо добавить конструктор (а потом и наследование), но я вообще не могу понять, куда добавить конструктор.. Открыть спойлер Закрыть спойлер #include <iostream>  
#include <stdio.h>  
#include <string.h>  
#include <stdlib.h>  
using namespace std;  
   
class Match {  
public:  
    struct _table {  
       char team1[50], team2[50], date[15], time[6], stadium[50];  
    };  
    struct _table *tab = (struct _table *)malloc(sizeof(struct _table));  
   
    void h_team() {  
    cout << "Enter home team: ";  
    cin.getline(tab->team1, 50);  
    }  
    void g_team() {  
    cout << "Enter guest team: ";  
    cin.getline(tab->team2, 50);  
    }  
    void date() {  
    cout << "Enter date of the match (1 January): ";  
    cin.getline(tab->date, 15);  
    }  
    void time() {  
    cout << "Enter time of the match (00:00): ";  
    cin.getline(tab->time, 6);  
    }  
    void stad() {  
    cout << "Enter stadium: ";  
    cin.getline(tab->stadium, 50);  
    }  
    void print() {  
    cout << endl << tab->team1 << " - " << tab->team2 << ", " << tab->date << ", " << tab->time << ", " << tab->stadium << endl;  
    }  
   
};  
   
int main() {  
Match One, Two;  
One.h_team();  
One.g_team();  
One.date();  
One.time();  
One.stad();  
   
cout << endl;  
   
Two.h_team();  
Two.g_team();  
Two.date();  
Two.time();  
Two.stad();  
   
cout << endl << endl;  
   
One.print();  
Two.print();  
   
cout << endl << endl;  
return 0;  
}  
  | 
  4.06.2014 / 22:46 |  | 
vl@volk    Пользователь  
   Сейчас: Offline 
 Имя: Владислав Откуда: Земля Регистрация: 26.12.2012
   | __________________
   знает толк  | 
  7.06.2014 / 23:36 |  | 
ZigaRev    Пользователь  
   Сейчас: Offline 
 Имя: Zigarev Регистрация: 07.06.2014
   | Люди, выручайте! Етот язый андроид поддержует? Тоисть можно на нём писать игры на андроид? Срочно!
   | 
  8.06.2014 / 02:24 |  | 
Its_Your_Soul    Пользователь  
   Сейчас: Offline 
 Имя: Саша Откуда: Винница Регистрация: 29.08.2012
   | ZigaRev,  Канешна     я писал контру онлайн  | 
  8.06.2014 / 11:27 |  | 
ВитаминКО    Супермодератор  
   Сейчас: Offline 
 Имя: Василиус Откуда: RZN Регистрация: 20.04.2012
   | если срочно, то есть гугл
  __________________
   わからない!!  | 
  9.06.2014 / 00:56 |  | 
prayncode    Пользователь  
   Сейчас: Offline 
 Регистрация: 08.03.2014
   | Можно, но минимальные знания Java всё-таки нужны.
   | 
  15.06.2014 / 09:31 |  | 
samogost    Пользователь  
   Сейчас: Offline 
 Имя: Сергей Откуда: Липецк Регистрация: 05.11.2013
   | Скажите есть ли на этом языке игровые классы?
   | 
  15.06.2014 / 09:34 |  | 
aNNiMON    Супервизор 
   Сейчас: Offline 
 Имя: Витёк Регистрация: 11.01.2010
   | samogost,  только в виде сторонних библиотек
  __________________
   let live  |