Ответ:
Stack Overflow на русском
регистрация войти
#include "stdafx.h" #include <conio.h> #define N 3 typedef struct { char name[25]; int tel[15]; int bday[3]; } NOTE; void setValue(NOTE blockNote[N]); void printValue(NOTE blockNote[N]); int _tmain(int argc, _TCHAR* argv[]) { NOTE blockNote[N]; setValue(blockNote); printValue(blockNote); return 0; } void setValue(NOTE blockNote[N]) { for(int i=0; i<N; i++) { printf("Enter name: "); gets_s(blockNote[i].name); printf("Enter tel: "); printf("%d", &blockNote[i].tel); printf("Enter bday (format: day.month.year): "); scanf_s("%d.%d.%d", &blockNote[i].bday[0], &blockNote[i].bday[1], &blockNote[i].bday[2]); printf("---\n"); } } void printValue(NOTE blockNote[N]) { for(int i=0; i<N; i++) printf("name: %s tel: %d bday: %d.%d.%d\n", blockNote[i].name, blockNote[i].tel, blockNote[i].bday[0], blockNote[i].bday[1], blockNote[i].bday[2]); }
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
Stack Overflow на русском
регистрация войти
#include "stdafx.h" #include <conio.h> #define N 3 typedef struct { char name[25]; int tel[15]; int bday[3]; } NOTE; void setValue(NOTE blockNote[N]); void printValue(NOTE blockNote[N]); int _tmain(int argc, _TCHAR* argv[]) { NOTE blockNote[N]; setValue(blockNote); printValue(blockNote); return 0; } void setValue(NOTE blockNote[N]) { for(int i=0; i<N; i++) { printf("Enter name: "); gets_s(blockNote[i].name); printf("Enter tel: "); printf("%d", &blockNote[i].tel); printf("Enter bday (format: day.month.year): "); scanf_s("%d.%d.%d", &blockNote[i].bday[0], &blockNote[i].bday[1], &blockNote[i].bday[2]); printf("---\n"); } } void printValue(NOTE blockNote[N]) { for(int i=0; i<N; i++) printf("name: %s tel: %d bday: %d.%d.%d\n", blockNote[i].name, blockNote[i].tel, blockNote[i].bday[0], blockNote[i].bday[1], blockNote[i].bday[2]); }