Guest User

xddd

a guest
Sep 4th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <fstream>
  4.  
  5. long potega(int a, int b){
  6. long w=a; int i=1;
  7. while (i<b){
  8. w=w*a;
  9. i++;
  10. }
  11. return w;
  12. }
  13.  
  14. using namespace std;
  15. main(){
  16. int p; int w; long wyn; int linie=0;
  17. int podst=0; int wykl=0;
  18. ifstream licz;
  19. licz.open("liczby.txt");
  20. if (licz){
  21. while (!licz.eof()) {
  22. licz>>p; if (p>podst) {podst=p;};
  23. licz>>w; if (w>wykl) {wykl=w;};
  24. wyn=potega(p,w);
  25. cout<<p<<"^"<<w<<"="<<wyn<<endl;
  26. linie++;
  27. }
  28. licz.close();
  29. }
  30. else {
  31. cout<<"Blad odczytu.";
  32. };
  33.  
  34. cout<<endl;
  35. cout<<"Liczba linii: "<<linie<<endl;
  36. cout<<"Najwieksza podstawa: "<<podst<<endl;
  37. cout<<"Najwiekszy wykladnik: "<<wykl<<endl;
  38. getch();
  39. }
Advertisement
Add Comment
Please, Sign In to add comment