Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- ofstream B;
- void func(int &c , int w)
- {
- int b=0,n=1,k=c;
- B << "Число в нужной системе счисления = ";
- if (c >= w){
- while (c >= w)
- {
- b = b*10 + (c%w * n);
- c /= w;
- n *= 10;
- }
- B << c;
- do{
- B << b % 10;
- b /= 10;
- } while (b > 0);
- B << endl;
- }
- else
- B << c << "\n";
- }
- void main()
- {
- setlocale(LC_ALL, "rus");
- int a;
- int q;
- ifstream A;
- cout << "Введите нужную систему счисления";
- cin >> q;
- A.open("A.txt", ios::in);
- B.open("B.txt");
- while (!A.eof())
- {
- A >> a;
- B << "Начально число = " << a << "\n";
- func(a,q);
- }
- A.close();
- B.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment