Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. ifstream in("reteta.in");
  4. ofstream out("reteta.out");
  5. char s[5001];
  6. int cnt;
  7. int verifica(char a[], int q)
  8. {
  9. while(s[q]==' ')
  10. {
  11. q++;
  12. }
  13. if(isdigit(s[q]))
  14. {
  15. int z=s[q]-'0';
  16. q++;
  17. while(isdigit(s[q]))
  18. {
  19. z*=10;
  20. z= z + (s[q]-'0');
  21. q++;
  22. }
  23. return z;
  24. }
  25. return 0;
  26. }
  27.  
  28. char incrediente[256][256];
  29. int su=0;
  30. int main()
  31. {
  32. in.getline(s,256);
  33. for(int i=0;i<strlen(s);i++)
  34. {
  35. if(s[i]==')')
  36. {
  37. su+=verifica(s, i+1);
  38. }
  39.  
  40. }
  41.  
  42. out<<su;
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement