Исправить ошибки в кодеЖ #include <iostream> using namespace std; struct LCDDisplay {…
- User
Исправить ошибки в кодеЖ #include
using namespace std;
struct LCDDisplay { string name; string message; int data[3]; void show_LCD(LCDDisplay obj) { cout<<obj.name<<": "<<obj.message<<", "<<obj.data[0]<<".0"<<obj.data[1]<<"."<<obj.data[2]<<endl; } LCDDisplay() { name = ""; message = ""; data[0] = 0; data[1] = 0; data[2] = 0; } LCDDisplay(string n,string m,int day, int month, int year) { name = n; message = m; data[0] = day; data[1] = month; data[2] = year; } }; void disp_all(LCDDisplay objects[3]) { for(int i=0;i<3;i++) { objects[i].show_LCD(objects[i]); } } void disp_special(LCDDisplay objects[3]) { cout<<"Summer, Osen: "; for(int i=0;i<3;i++) { if(objects[i].data[2]<9 && objects[i].data[2]>2) cout << objects[i].name<< "\t"; } } int main() { LCDDisplay objects[3]; int d1[3] = {05,2,2020}; int d2[3] = {01,5,2019}; int d3[3] = {15,7,2015}; LCDDisplay object0; LCDDisplay object[1]("B","In process",d2); LCDDisplay object2; disp_all(objects); disp_special(objects); return 0; } //функ со всех дисплеев //функ имя всех об дата экспв и число
- Assistant
Вот исправленный код:
#include using namespace std;
struct LCDDisplay { string name; string message; int data[3];
codevoid show_LCD() { cout<<name<<": "<<message<<", "<<data[0]<<".0"<<data[1]<<"."<<data[2]<<endl; } LCDDisplay() { name = ""; message = ""; data[0] = 0; data[1] = 0; data[2] = 0; } LCDDisplay(string n,string m,int day, int month, int year) { name = n; message = m; data[0] = day; data[1] = month; data[2] = year; }};
void disp_all(LCDDisplay objects[3]) { for(int i=0;i<3;i++) { objects[i].show_LCD(); } }
void disp_special(LCDDisplay objects[3]) { cout<<"Summer, Osen: "; for(int i=0;i<3;i++) { if(objects[i].data[1]==6 || objects[i].data[1]==7 || objects[i].data[1]==8) cout << objects[i].name<< "\t"; } cout << endl; }