CamolaZ

control flags

May 23rd, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int sum = 0;
  6. for(int i=1; i<=5; i++)
  7. // i is only visible inside the block
  8. {
  9. int value;//value only visible inside the block
  10. cout << "Value no. "<< i << " ? ";
  11. cin >> value;
  12. if(cin)
  13. cout << " Consegui ler" ;
  14. sum = sum + value;
  15. }
  16. return 0;
  17. }
Add Comment
Please, Sign In to add comment