Mercurial > codedump
comparison win95kg.cpp @ 43:3487aa65ca56
Update win95kg.cpp
committer: GitHub <noreply@github.com>
author | Paper <37962225+mrpapersonic@users.noreply.github.com> |
---|---|
date | Wed, 30 Jun 2021 02:40:58 -0400 |
parents | 1c81c5106b59 |
children |
comparison
equal
deleted
inserted
replaced
42:1c81c5106b59 | 43:3487aa65ca56 |
---|---|
96 } | 96 } |
97 | 97 |
98 int e() { | 98 int e() { |
99 int first_digits; | 99 int first_digits; |
100 int last_digit; | 100 int last_digit; |
101 int second_segment = 5; | 101 int second_segment; |
102 int sum = 1; | 102 int sum = 1; |
103 while (sum % 7 != 0) { | 103 while (sum % 7 != 0) { |
104 sum = 0; | 104 sum = 0; |
105 first_digits = rand() % 10000; | 105 first_digits = rand() % 10000; |
106 last_digit = rand() % 10; | 106 last_digit = rand() % 10; |
107 while ((last_digit == 0) || (last_digit >= 8)) { | 107 while ((last_digit == 0) || (last_digit >= 8)) { |
108 last_digit = rand() % 10; | 108 last_digit = rand() % 10; |
109 } | 109 } |
110 std::string second_segment_p1 = (std::to_string(first_digits) + std::to_string(last_digit)); | 110 std::string second_segment_p1 = (std::to_string(first_digits) + std::to_string(last_digit)); |
111 second_segment = std::stoi(second_segment_p1); | |
112 for(char &c :second_segment_p1) { | 111 for(char &c :second_segment_p1) { |
113 sum += c - '0'; | 112 sum += c - '0'; |
114 } | 113 } |
115 } | 114 } |
116 return second_segment; | 115 return std::stoi(second_segment_p1); |
117 } | 116 } |