-
Notifications
You must be signed in to change notification settings - Fork 165
Esercizio sum.cpp svolto #359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Esercizio sum.cpp svolto #359
Conversation
exercises/sum.exe
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non pushare l'eseguibile
exercises/sum.cpp
Outdated
| int input, sum=0; | ||
| cout << "Insert the first number: " << endl; | ||
| cin >> input; | ||
| sum += input; | ||
| cout << "Insert the second number: " << endl; | ||
| cin >> input; | ||
| sum += input; | ||
| cout << "Sum: " << sum << endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Crea una funzione esterna, fai inserire inserire le variabili e chiama la funzione per la somma
exercises/sum.cpp
Outdated
| } | ||
|
|
||
| int main () { | ||
| cout << "Sum: " << Sum() << endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fai inserire gli interi non dentro la funzione
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ma funziona? allora va bene
| cout << "Insert the second number: " << endl; | ||
| cin >> input; | ||
| cout << "Sum: " << Sum(sum, input) << endl; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
manca return 0
No description provided.