Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <fstream>
  2. #include <algorithm>
  3. #include <iterator>
  4.  
  5. using namespace std;
  6.  
  7. int number[100];
  8. const char* question[100];
  9. int i,c = 0;
  10. string line;
  11. int kek = 0;
  12.  
  13. void readFile() {
  14. ifstream questions("questions.txt");
  15. while (getline(questions, line)) {
  16. if (line.substr(0, 1) == "#") {
  17. string tmp1 = line.substr(1, 20);
  18. remove(line.begin(), line.end(), ' ');
  19. if (tmp1 != "1") question[i] = tmp1.c_str();
  20. i++;
  21. questions.ignore(numeric_limits<streamsize>::max(), '\n');
  22. } else {
  23. number[c] = atoi(line.substr(0,1).c_str());
  24. c++;
  25. questions.ignore(numeric_limits<streamsize>::max(), '\n');
  26. }
  27. kek++;
  28. }
  29. questions.close();
  30. }
  31.  
  32. int main() {
  33. readFile();
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement