Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- using namespace std;
- ofstream zapis("zapis.txt");
- ifstream odczyt("dane.txt");
- void rozklad(int a)
- {
- int d=2;
- while(a!=1)
- {
- if(a%d==0)
- {
- cout<<d<<" ";
- zapis<<d<<" ";
- a=a/d;
- }
- else
- d++;
- }
- }
- int main(int argc, char** argv) {
- int a,i;
- for(i=1;i<=7;i++)
- {
- do
- {
- odczyt>>a;
- cout<<"dzielniki "<<a<<"->";
- }
- while(a<=1);
- zapis<<a<<"-";
- rozklad(a);
- zapis<<endl;
- cout<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment