Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cmath>
- using namespace std;
- int main()
- {
- fstream dane;
- dane.open("dane1.txt");
- fstream wynik;
- wynik.open("wynik1.txt", ios::out);
- while(!dane.eof())
- {
- int tab[10]={0};
- int k=2;
- int i=0;
- int x=0;
- dane >> x;
- while(x>1)
- {
- while(x%k==0)
- {
- i++;
- tab[k]=i;
- x/=k;
- }
- k++;
- i=0;
- }
- for(int y=1;y<10;y++)
- {
- if(tab[y]!=0)
- {
- if(tab[y]==1) wynik<<y;
- if(tab[y]>1)
- {
- wynik << y << "^" << tab[y] << " ";
- }
- }
- }
- }
- wynik.close();
- dane.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement