Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <iostream>
- #include <string>
- using namespace std;
- struct Student{
- string name;
- int mark[31]{};
- void init(string str) {
- int id_st = 0;
- int id_en = 0;
- string small_str;
- int counter = 0;
- for (int k = 0; k < str.length(); ++k) {
- if (str[k] == '\t') {
- id_en = k;
- small_str = str.substr(id_st, id_en - id_st);
- if (counter == 0) {
- name = small_str;
- }
- else {
- mark[counter - 1] = atoi(small_str.data());
- }
- //cout << small_str << endl;
- id_st = id_en + 1;
- counter++;
- }
- }
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment