Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- struct kupon
- {
- unsigned char value = 0;
- unsigned char type = 0; // 0 = kn, 1 = %
- } temp;
- kupon parse(string x)
- {
- kupon temp;
- cout << "vr " <<temp.value << endl;
- int i = 0;
- for(char c : x)
- {
- if(c != '%' && c != 'k' && c != 'n')
- {
- temp.value += pow(10, i) * (int)c;
- }
- if(c == '%')
- {
- temp.type = 1;
- break;
- }
- i++;
- }
- cout << temp.type << " " << temp.value << endl;
- return temp;
- }
- int main()
- {
- int n;
- cin >> n;
- kupon kuponi[n];
- string x;
- for(int i = 0; i < n; i++)
- {
- cin >> x;
- kuponi[i] = parse(x);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement