Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <math.h>
- using namespace std;
- int main()
- {
- int liczba;
- cout << "Podaj liczbe" << endl;
- cin >> liczba;
- int bezwzgledna = fabs(liczba);
- cout << bezwzgledna;
- cout <<endl;
- cout <<endl;
- fstream plik;
- plik.open("dane.txt", ios::in);
- if (plik.is_open())
- {
- cout << "Plik zostal otwarty\n";
- }
- else
- {
- cout << "plik nie zostal otwarty\n";
- }
- int tab[7];
- int temp;
- for( int i =0; i<7; i++)
- {
- plik>>tab[i];
- cout<<tab[i]<<" ";
- }
- cout << endl;
- cout << endl;
- for(int i = 0; i<7; i++){
- temp = fabs(tab[i]);
- cout << temp << " ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement