1. Trang chủ
  2. » Công Nghệ Thông Tin

đáp án đề thi lí thuyết tốt nghiệp khóa 2 - lập trình máy tính - mã đề thi ltmt - lt (13)

5 209 2

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 5
Dung lượng 101,5 KB

Nội dung

    !!"#!$$% &'()*+,- +.&'/0,10,2+. +34567&8'+#'$9 :; <;= <>? @ABCDB;   !"!#$%#&$'()*# #&+,-.#/01#234564 !"7#89:,;<=*=/ 345>+!3495:$345?@3495#A!B345> 3495*$ )$+#3,5C !/#D?E# #&+-.#/01#234564 !"7#89:;<=*=/ 345>+!3495:$345?@3495#A!B345> 3495*$)$+#35C !/#D?E# #A F$/#G+!-.#/01#234564 !"7#89: !;<=*=/345>+!3495:$345?@3495#A! B345>3495*$)$+#3!5C !/#D ?E# #)$9+#H:##I ,<JK ,JK ,<JK ,<JK L0MN  !"!#$%#&$'()*#>+!OMP'!Q$ RSTU<V<,<,<UU<VK<JK<WW<WX  -YK ,<ZK ,<JK J [$\#]E#^0N#$O7 #_"`a-:$b⊇#cb #&d#1$-:$cb>bce#ce #_fg-:$cbe#cb>ce #&d#1$-:$cb>ce#cbe ,<JK ,<JK ,<JK ,<JK L0MN -7$B!=$M!h& ; &i6j; J; i6j\; V; &6#]d1$JkV; \; &&60"`a; K; &&60fg; l; &&i6H:#0kK; Z; &i6jV; W; &6d1$lkZ; U; &6H:#0VkW; ,;6jK; ;&6d1$Uk,; J;&6H:#0Vk; <,  <,  -JYK RC &+ R3,5 R35 R3J5 R3V5 R3\5 R3K5 R3l5 R3Z5 R3W5 & 1$ U V , , UU VK JK WW W &+ ! U V , UU E VK $" WW &+J 9 U , $" UU E VK WW &+V U , W E UU VK WW &+\ , W JK 9E UU WW &+K W JK VK "" UU &+l JK VK WW UU &+Z VK WW UU &+W WW UU FD G;H ! 9 I $! $" E 9E "" II 9 #include <conio.h> #include <iostream.h> #include <math.h> class DT { private: double a[20];// Mang chua cac he so da thuc a0, a1, int n ;// Bac da thuc public: void nhap(); void hienthi(); DT operator+(const DT &d2); double operator^(double x);// Tinh gia tri da thuc }; ,<JK void DT::hienthi() { cout<<a[0]<<"X^0"; for (int i=1 ;i<= n ;++i) cout<<"+"<< a[i] <<"X^"<<i ; } ,<JK void DT::nhap() { cout << "Bac da thuc:"; cin >> n; cout << "Nhap cac he so da thuc:" ; for (int i=0 ;i<=n ;++i) { cout << "\n He so bac"<<i<<":" ; cin >> a[i] ; } } ,<JK  -VYK DT DT::operator+(const DT &d2) { DT d; int k,i; k = (n > d2.n)?n:d2.n ; for (i=0;i<=k ;++i) if (i<=n && i<=d2.n) d.a[i] = a[i] + d2.a[i]; else if (i<=n) d.a[i] =a[i]; else d.a[i] = d2.a[i]; i = k; while (i>0 && d.a[i]==0.0) i; d.n=i; return d ; } ,<ZK double DT::operator^(double x) { double s=0.0 , t=1.0; for (int i=0 ;i<= n ;++i) { s+= a[i]*t; t *= x; } return s; } ,<JK void main() { DT p,q,f; double x,g; clrscr(); cout <<"\n Nhap da thuc P :" ;p.nhap(); cout <<"\n Nhap da thuc Q :" ;q.nhap(); cout << "\n Nhap so thuc x :" ;cin >> x; f = (p+q); g = f^x; cout << "\n Da thuc f "; f.hienthi(); cout<<"\n x =" << x; cout << "\n f(x) = "<<g; getch(); } ,<JK @ADJ  -\YK  -KYK . nhap(); void hienthi(); DT operator+(const DT &d2); double operator^(double x);// Tinh gia tri da thuc }; ,<JK void DT::hienthi() { cout<<a[0]<<"X^0"; . >> x; f = (p+q); g = f^x; cout << " Da thuc f "; f.hienthi(); cout<<" x =" << x; cout << " f(x)

Ngày đăng: 17/03/2014, 17:56

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w