Форум программистов, компьютерный форум 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. Просмотров 777. Ответов 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
Посмотрите здесь:

C++ Class
Class C++
Class C++
C++ Dynamic Cast C++
Pointers and dynamic arrays C++
Invalid pointer addition C++
Arrays. Calculate the number of items greater than 5 C++
C++ public class && static class
C++ Makefile dynamic library creation error
Arrays to vectors C++
C++ Arrays, как работает данная программа?
Class C++

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

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

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