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

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

Восстановить пароль Регистрация
 
Almat29
0 / 0 / 0
Регистрация: 29.11.2013
Сообщений: 26
29.11.2013, 11:27     Using dynamic arrays, implement a polynomial class with polynomial addition, subtraction, and multiplication #1
Вот само задание:

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
Посмотрите здесь:

Opiat k temie DYNAMIC ARRAYS in C C++
C++ Нужно объект типа класс проинициализировать с помощью перегруженного конструктора Class::Class( bool a )
Pointers and dynamic arrays C++
Разъясните код пжлст(выдает ошибку:cannot convert from 'class std::list<class c_bullet *,class std::allocator<class c_bullet *> >::iterator' to 'int') C++
Работа с class ами. Заполнение дин. массива типа class C++
Invalid pointer addition C++
C++ Create a programm that creates an object of created class Time and tests the member functions of class
Arrays to vectors C++

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

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

Текущее время: 11:31. Часовой пояс GMT +3.
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
Рейтинг@Mail.ru