|
Программирование >> Расширенная версия языка c++
Приложение В. Ответы на вопросы и решения упражнений 555 friend ostream ator (ostream eam, factor ob) ; friend istream ioperator (istream Sstream, factor sob) ; int n; num = i; for(n=2; n<(i/2); П++) r . if(! (i%n)} break; i/2) act = n; else Ifact = 1; . ; ;. istream (istream factor stream ob.num; int n; for{n=2; n<(ob.num/2) ; n+4} *. \. if ( ! (ob.num*n)) break; = n; else ob. Ifact = 1; return stream; ostream fioperator (ostream eam, factor ob) i stream act Это наеньший делитель числа stream << ob.num \n, return stream; int { factor cout cin o; cout return 586 Самоучитель C++ Проверка усвоения материала главы 8 1. #include <iostream> namespace std; cout 100 ; cout.unsetf (ios: ;dec) ; сброс флага dec : cout.setf (ios:: hex); cou< 10< ; сброс флага hex cout.setf (ios::oct); cou 100 \n; return 2. ttinclude <iostream> using namespace std; u::j.:. ;; intmain ( ) cout.setf(ios::left); cout.precision(2); cout.fillC*),-cout.width(20); cout return 0; За. ttinclude <iostream> using namespace std; int { cout 100 ; cou< he 10< cout oct 100 return 0; Приложение В. Ответы н опросы и решение жнений 587 ЗЬ. #include <iostream> V..- Г> . ; ; V ttinclude <ioTnanip> using namespace std; int mainO cout setiosflags(ios::left) ; cout setprecision (2) ; . cout set fill(*); cout cou 1000.5354 \n; . . , , return 0; 4 fmtflags f; f lags 0 ; сохранение .. . cout.flagsO ; отображение 5. ttinc -.stream> us? . nai: ;-;ic -itd; o -;3 p:i . ili- jse; exponent; double result; результат возведения в степень : public: pwr(int b, int e); friend ostream Soperator (ostream Sstream, pwr ob) ; friend istream fioperator (istreamfistream, pwr Sob); int e) base = b; exponent = e; result = 1; for{; e; e -) result - result * base; ostream pwr ob) stream в степени stream равно
|
© 2006 - 2025 pmbk.ru. Генерация страницы: 0
При копировании материалов приветствуются ссылки. |