Advertisement
MateuszRagiel

c++ wczytywanie danych prostokata z pliku i obliczanie pola

Oct 24th, 2014
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. //program pobiera dane z pliku prostokat.txt i obliczy pole tego prostokata.
  2.  
  3. #include <iostream>
  4. #include <fstream>
  5. #include <cstdio>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. int a,b;
  11. ifstream wejscie("prostokat.txt");
  12. if (!wejscie)
  13. {
  14. cout<<"Nie mozna odtworzyc pliku";
  15. getchar();
  16. return 1;
  17. }
  18. wejscie>>a>>b;
  19. wejscie.close();
  20. cout<<"Pole prostokata wynosi: "<<a*b;
  21. getchar();
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement