954,496 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Urgently! Need help for C++ class

:sad: Write a C++ template class Nvector that enables arrays with negative subscripts to be
defined. The class should be usable in the following code fragment:

Nvector<double> a; // instantiate double array class
a.resize(-10, 10); // allocate array from locations -10 to 10
for(int i=-10 ; i<=10 ; ++i)
a[i] = exp(-k*(T-t[i])); // fill array


<< moderator edit: added code tags : [code][/code] >>

The class should be written so that array set/access is optimally efficient. Show through the template specification that multidimensional arrays can also be defined.

JohnHull
Newbie Poster
5 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

Okay, what do you have so far?

Dogtree
Posting Whiz in Training
233 posts since May 2005
Reputation Points: 35
Solved Threads: 3
 

This is the question!

JohnHull
Newbie Poster
5 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

We only give homework help to those who show effort

You haven't written one line of code -- that hardly shows effort.

Dave Sinkula
long time no c
Team Colleague
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
 

The only way to learn and master c++ is if you practice and get corrected....

zandiago
Nearly a Posting Maven
2,480 posts since Jun 2007
Reputation Points: 129
Solved Threads: 26
 

With all the pace of continental drift, your reply to "urgent" took all of 2 YEARS.

Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You