This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
courses:programming:topic9 [2016/11/19 14:25] kkv |
courses:programming:topic9 [2022/12/10 09:08] (current) |
||
---|---|---|---|
Line 8: | Line 8: | ||
* https://github.com/moevm/pr1-samples/blob/master/2016-11-03-20-34.11/main.cpp | * https://github.com/moevm/pr1-samples/blob/master/2016-11-03-20-34.11/main.cpp | ||
- | <code c++> | ||
- | // Programming 1. Sample at 2016-11-10-14-01.08 | ||
- | #include <stdio.h> | ||
- | struct Person | ||
- | { | ||
- | char name[100]; | ||
- | int age; | ||
- | }; | ||
- | |||
- | |||
- | int main(/*int c, char **v */) | ||
- | { | ||
- | struct Person data[5]; | ||
- | |||
- | FILE *f = fopen("a.txt","r"); | ||
- | |||
- | //int ret = fscanf(f, "\"%s\" %d",data.name,&data.age); | ||
- | fgets(data.name, 50, f); | ||
- | |||
- | printf("[%s]\n",data.name); | ||
- | | ||
- | for(int i=0;i<5;i++) | ||
- | printf("%s, age %d\n",????); | ||
- | |||
- | return 0; | ||
- | } | ||
- | </code> |