Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void llegeix_i_suma(int& suma, bool& final) {
- int n;
- char c;
- cin >> n >> c;
- suma = n;
- while (c == '+') {
- cin >> n >> c;
- suma += n;
- }
- if (c == '.') final = true;
- else final = false;
- }
- int main() {
- bool final = false;
- while (not final) {
- int suma = 0;
- llegeix_i_suma(suma, final);
- cout << suma << endl;
- }
- }
Add Comment
Please, Sign In to add comment