Форум программистов, компьютерный форум CyberForum.ru

С++ для начинающих

Войти
Регистрация
Восстановить пароль
 
Almat29
0 / 0 / 0
Регистрация: 29.11.2013
Сообщений: 26
#1

Using dynamic arrays, implement a polynomial class with polynomial addition, subtraction, and multiplication - C++

29.11.2013, 11:27. Просмотров 881. Ответов 0
Метки нет (Все метки)

Вот само задание:

Using dynamic arrays, implement a polynomial class with polynomial addition, subtraction, and multiplication.
Discussion: A variable in a polynomial does nothing but act as a placeholder for the coefficients. Hence, the only interesting thing about polynomials is the array of coefficients and the corresponding exponent. Think about the polynomial x^3+x+1, what is the coefficient of term x^2 ? One simple way to implement the polynomial class is to use an array of doubles to store the coefficients. The index of the array is the exponent of the corresponding term. If a term is missing, then it simply has a zero coefficient.
Provide a default constructor, a copy constructor, and a parameterized constructor that enables an arbitrary polynomial to be constructed.
Supply an overloaded operator = and a destructor.

Provide these operations:
polynomial + polynomial, constant + polynomial, polynomial + constant,
polynomial – polynomial, constant – polynomial, polynomial – constant,
polynomial * polynomial, constant * polynomial, polynomial * constant,
Supply functions to assign and extract coefficients, indexed by exponent.
Supply a function to evaluate the polynomial at a value of type double.
A sample testing code will be provided for your reference. But your implemention doesn't have to match exactly my testing code. If your choice of implementing a function as a member, a friend, or a standalone function is different as mine, please comment it in your assignment and provide your own testing code.
Similar
Эксперт
41792 / 34177 / 6122
Регистрация: 12.04.2006
Сообщений: 57,940
29.11.2013, 11:27     Using dynamic arrays, implement a polynomial class with polynomial addition, subtraction, and multiplication
Посмотрите здесь:
Pointers and dynamic arrays C++
Fill in the blanks to calculate and return the multiplication product of the array elements C++
Invalid pointer addition C++
Arrays to vectors C++
Работа с class ами. Заполнение дин. массива типа class C++
C++ Нужно объект типа класс проинициализировать с помощью перегруженного конструктора Class::Class( bool a )
C++ Create a programm that creates an object of created class Time and tests the member functions of class
enum и class как составляющие другого class C++
C++ Arrays, как работает данная программа?
Arrays. Calculate the number of items greater than 5 C++
vector<[class]> in class и перегрузка (ostream) C++
C++ Объяснить причины ошибки "Extra qualification 'CLASS CONSTRUCTOR' and 'CLASS' has incomplete type"

Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
После регистрации реклама в сообщениях будет скрыта и будут доступны все возможности форума.
Ответ Создать тему
Опции темы

КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Рейтинг@Mail.ru