Отредактировать код что бы не было в строках. c++#include #include #include #include #include #define m 5#define n 2using namespace std; struct fio{ char fam[100]; char name[100]; char otchestvo[100]; }; struct birthday{ int day; int mounth; int year; }; struct address{ char street[100]; char house[100]; int apart; }; struct mark{ char object[100]; int grade; }; struct student{ fio f; birthday b; address a; char number[10]; char facul[100]; char group[100]; int course; mark m[5]; }; int main(void){ setlocale(lc_all, "rus"); /*№1*/ cout < < " --- №1---" < < endl < < " [ввод с клавиатуры данных в массив, состоящий из 10 структур типа student]" < < endl; student s[2]; for (int i = 0; i < n; i++) { cout < < "familiya: "; cin > > s[i].f.name; cout < < "name: "; cin > > s[i].f.name; cout < < "otchestvo: "; cin > > s[i].f.otchestvo; cout < < "day: "; cin > > s[i].b.day; cout < < "mounth: "; cin > > s[i].b.mounth; cout < < "year: "; cin > > s[i].b.year; cout < < "street: "; cin > > s[i].a.street; cout < < "house: "; cin > > s[i].a.house; cout < < "apartment: "; cin > > s[i].a.apart; cout < < "phone number: "; cin > > s[i].number; cout < < "faculty: "; cin > > s[i].facul; cout < < "group: "; cin > > s[i].group; cout < < "course: "; cin > > s[i].course; cout < < endl; cout < < "mark: " < < endl; for (int j = 0; j < m; j++) { cout < < "object: "; cin > > s[i].m[j].object; cout < < "grade: "; cin > > s[i].m[j].grade; } cout < < endl; } cout < < endl; /*№2*/ cout < < " --- №2---" < < endl < < " [вывод на экран данных из массива типа student]" < < endl; for (int i = 0; i < n; i++) { cout < < "1) fio: "; cout < < s[i].f.fam < < " " < < s[i].f.name < < " " < < s[i].f.otchestvo < < endl; cout < < "2) birthday: "; cout < < s[i].b.day < < "." < < s[i].b.mounth < < "." < < s[i].b.year < < endl; cout < < "3) adress"; cout < < s[i].a.street < < "," < < s[i].a.house < < "," < < s[i].a.apart < < endl; cout < < "4) telephone number: "; cout < < s[i].number < < endl; cout < < "5) faculty" < < " "; cout < < s[i].facul < < "," < < s[i].course < < "," < < s[i].group < < endl; cout < < "6) mark: " < < endl; for (int j = 0; j < 5; j++) { cout < < s[i].m[j].object < < " : "; cout < < s[i].m[j].grade < < endl; } } cout < < endl;
// delete.cpp: определяет точку входа для консольного приложения.
//
#include "stdafx.h"
#include <iostream>
#include <conio.h>
#define m 5
#define n 2
using namespace std;
struct Fio
{
char fam[100];
char name[100];
char otchestvo[100];
};
struct Birthday
{
int day;
int mounth;
int year;
};
struct Address
{
char street[100];
char house[100];
int apart;
};
struct Mark
{
char object[100];
int grade;
};
struct STUDENT
{
Fio f;
Birthday b;
Address a;
char number[10];
char facul[100];
char group[100];
int course;
Mark M[5];
};
int main(void)
{
setlocale(LC_ALL, "rus");
/*№1*/
cout << " ---Задание №1---" << endl << " [Ввод с клавиатуры данных в массив, состоящий из 10 структур типа STUDENT]" << endl;
STUDENT s[2];
for (int i = 0; i < n; i++)
{
cout << "Familiya: "; cin >> s[i].f.fam;
cout << "Name: "; cin >> s[i].f.name;
cout << "Otchestvo: "; cin >> s[i].f.otchestvo;
cout << "Day: "; cin >> s[i].b.day;
cout << "Mounth: "; cin >> s[i].b.mounth;
cout << "Year: "; cin >> s[i].b.year;
cout << "Street: "; cin >> s[i].a.street;
cout << "House: "; cin >> s[i].a.house;
cout << "Apartment: "; cin >> s[i].a.apart;
cout << "Phone Number: "; cin >> s[i].number;
cout << "Faculty: "; cin >> s[i].facul;
cout << "Group: "; cin >> s[i].group;
cout << "Course: "; cin >> s[i].course;
cout << endl;
cout << "Mark:" << endl;
for (int j = 0; j < m; j++)
{
cout << "Object: "; cin >> s[i].M[j].object;
cout << "Grade: "; cin >> s[i].M[j].grade;
}
cout << endl;
}
cout << endl;
/*№2*/
cout << " ---Задание №2---" << endl << " [Вывод на экран данных из массива типа STUDENT]" << endl;
for (int i = 0; i < n; i++)
{
cout << "1) FIO:";
cout << s[i].f.fam << " " << s[i].f.name << " " << s[i].f.otchestvo << endl;
cout << "2) Birthday:";
cout << s[i].b.day << "." << s[i].b.mounth << "." << s[i].b.year << endl;
cout << "3) Adress";
cout << s[i].a.street << "," << s[i].a.house << "," << s[i].a.apart << endl;
cout << "4) Telephone Number:";
cout << s[i].number << endl;
cout << "5) Faculty" << " ";
cout << s[i].facul << "," << s[i].course << "," << s[i].group << endl;
cout << "6) Mark:" << endl;
for (int j = 0; j < m; j++)
{
cout << s[i].M[j].object << " : ";
cout << s[i].M[j].grade << endl;
}
}
_getch();
}
Объяснение:
cout << "Familiya: "; cin >> s[i].f.name;
cout << "Name: "; cin >> s[i].f.name;
s[i].f.fam выводило мусор, т.к. ты ничего не записал
Пример вывода в приложенном файле