Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #include <string.h>
- #include <stdlib.h>
- #include <ctype.h>
- #include <time.h>
- struct student
- {
- char name[100];
- int roll;
- int marks;
- };
- struct student ar[500];
- int main()
- {
- int t, i = 0, j, k, l, a, b, c, d, x, y, z, n;
- char str[1000], str2[1000], *ptr;
- freopen("input.txt", "r", stdin);
- for (; ;)
- {
- gets(str);
- if (feof(stdin)) break;
- l = 0, ptr = strtok(str, " ");
- while(ptr != 0)
- {
- if (l == 0) strcpy(ar[i].name, ptr);
- if (l == 1) ar[i].roll = atoi(ptr);
- if (l == 2) ar[i].marks = atoi(ptr);
- l++;
- ptr = strtok(0, " ");
- }
- i++;
- }
- for (l = 0; l < i; l++) printf("%10s %10d %10d\n", ar[l].name, ar[l].roll, ar[l].marks);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement