#include <bits/stdc++.h>
using namespace std;
long long warioderivative(string polynomialTerm, long long
coefficientval)
{
string coeffStr = "";
int i;
for (i = 0; polynomialTerm[i] != 'x'; i++)
{
coeffStr.push_back(polynomialTerm[i]);
}
long long coeff = atol(coeffStr.c_str());
// Get Power (Skip 2 characters for x and ^)
string powStr = "";
for (i = i + 2; i != polynomialTerm.size(); i++)
{
powStr.push_back(polynomialTerm[i]);
}
long long power = atol(powStr.c_str());
// For ax^n, we return a(n)x^(n-1)
if(coeff==0) // coefficient is 1 this coeff will zero
{
coeff=1;
}
return coeff * power * pow(coefficientval, power - 1);
}
long long derivativeVal(string& poly, int val)
{
long long ans = 0;
// We use istringstream to get input in tokens
istringstream is(poly);
string pTerm;
while (is >> pTerm) {
// If the token is equal to '+' then continue with the string
if (pTerm == "+")
continue;
// Otherwise find the derivative of that
// particular term
else
ans = (ans + warioderivative(pTerm, val));
}
return ans;
}
int main()
{
string str = "2x^3 + 10x^1 + x^2";
int val = 5;
cout << derivativeVal(str, val);
return 0;
}
/* output:- 170
***************************
derivative of 2x^3 + 10x^1 +x^2 is
6x^2 + 10 + 2x^1
putting x=5
6*25 + 10 + 2*5
170
*/
In C++ Problem: As usual, Wario is concerned about nothing other than acquiring more money. In or...
Rusty Steuben, owner of Minnehaha Marine & Camp, is worried about his business’ future. He has tried various strate- gies for two years now, and he’s still barely breaking even. Two years ago, Rusty bought the inventory, supplies, equip- ment, and business of Minnehaha Marine & Camp, located on the edge of Minneapolis, Minnesota. The business is in an older building along a major highway leading out of town, sev- eral miles from any body of water. The previous owner...
Forrester, NMSU, Exante Financial Services, and Others: Getting Real about Strategic Planning It must be nice to be the CIO of a FedEx, or a GE, or a Credit Suisse, where IT and the business are so tightly aligned you can barely tell the two apart. In such companies, corporate leaders understand that IT is a strategic asset and support it as such. These are places where the CIO is encouraged to spend the majority of his time on the...
Question 2 Gluck Corporation Johan, now in his fourth year with Gluck Corporation, was made a factory manager three months ago after completing the company’s management-training program. Gluck owns pulpprocessing factory that produce various grades of paper from fast-growing, genetically altered trees. Johan’s factory, the smallest and oldest of Gluck’s, is located in upstate Georgetown, near a small town. It employs between 100 and 175 workers, mostly from the nearby town. In fact, the factory boasts about employees whose fathers...
Mini Case Building Shared Services at RR Communications4 4 Smith, H. A., and J. D. McKeen. “Shared Services at RR Communications.” #1-L07-1-002, Queen’s School of Business, September 2007. Reproduced by permission of Queen’s University, School of Business, Kingston, Ontario, Canada. Vince Patton had been waiting years for this day. He pulled the papers together in front of him and scanned the small conference room. “You’re fired,” he said to the four divisional CIOs sitting at the table. They looked nervously...
Mini Case Building Shared Services at RR Communications4 4 Smith, H. A., and J. D. McKeen. “Shared Services at RR Communications.” #1-L07-1-002, Queen’s School of Business, September 2007. Reproduced by permission of Queen’s University, School of Business, Kingston, Ontario, Canada. Vince Patton had been waiting years for this day. He pulled the papers together in front of him and scanned the small conference room. “You’re fired,” he said to the four divisional CIOs sitting at the table. They looked nervously...
This C++ Program consists of: operator overloading, as well as experience with managing dynamic memory allocation inside a class. Task One common limitation of programming languages is that the built-in types are limited to smaller finite ranges of storage. For instance, the built-in int type in C++ is 4 bytes in most systems today, allowing for about 4 billion different numbers. The regular int splits this range between positive and negative numbers, but even an unsigned int (assuming 4 bytes)...
The Care Services Improvement Partnership (CSIP) was created in the United Kingdom to support improvement and development in a range of services across health and local government, for children, adults, and older people, including those experiencing mental distress, physical disability, or learning disability. CSIP have a successful track record in providing developmental support for provider organizations and commissioners across the UK National Health Service (NHS), local authorities, regional agencies, and voluntary and private organizations. In doing this CSIP can draw...
Zipcar: “It’s Not About Cars—It’s About Urban Life” Imagine a world in which no one owns a car. Cars would still exist, but rather than owning cars, people would just share them. Sounds crazy, right? But Scott Griffith, CEO of Zipcar, the world’s largest car-share company, paints a picture of just such an imaginary world. And he has nearly 800,000 passionate customers—or Zipsters, as they are called—who will back him up. Zipcar specializes in renting out cars by the hour...
C++ Inheritance Problem Step a: Suppose you are creating a fantasy role-playing game. In this game we have four different types of Creatures: Humans, Cyberdemons, Balrogs, and elves. To represent one of these Creatures we might define a Creature class as follows: class Creature { private: int type; // 0 Human, 1 Cyberdemon, 2 Balrog, 3 elf int strength; // how much damage this Creature inflicts int hitpoints; // how much damage this Creature can sustain string getSpecies() const; //...
Bradford Consultants (BC) is a professional services firm that provides consulting services to improve business processes. Many of BC services fall under the areas of organizational design, work-flow analysis, efficiency improvement, and leveraging technology to improve business outcome effectiveness. Founded over 40 years ago , BC, is similar to other firms of this type (e.g., law or accounting firms) in that the same people who sell the services are also those that do the work. As in a large law...