Become a part of the TranceAddict community!Frequently Asked Questions - Please read this if you haven'tSearch the forums
TranceAddict Forums > Main Forums > Chill Out Room > C++ Hw
Pages (2): « 1 [2]   Last Thread   Next Thread
Share
Author
Thread    Post A Reply
Kirby
Supreme tranceaddict



Registered: Mar 2002
Location: Middletown, CT or Durham, NH

I'm too lazy to write an entire program solving this problem right now but I did it a few times before for my math hw (prgm in C++) so if you come up with a solution to your problem, and you have anything that doesn't work about it, post it up on the thread and I'd be happy to help you with something that doesn't work... I <3 C++... !!! ::wishes I was taking computer science this term::

Old Post Oct-07-2002 14:10  United States
Click Here to See the Profile for Kirby Click here to Send Kirby a Private Message Add Kirby to your buddy list Report this Post Reply w/Quote Edit/Delete Message
whiskers
old skool



Registered: Sep 2001
Location: in your dreams

quote:
Originally posted by AnotherWay83


Perl...heh, gotta love that language

it's so fuckin high level, i've actually seen entire poems written in it, and they actually get parsed perfectly fine

i will post 1 if u want.


yes! post it! i wanna see it!

btw, what's more high level, pearl or c++?


___________________

Old Post Oct-07-2002 20:54  Ukraine
Click Here to See the Profile for whiskers Click here to Send whiskers a Private Message Add whiskers to your buddy list Report this Post Reply w/Quote Edit/Delete Message
drizzt81
Professional Lamer



Registered: Nov 2001
Location: GTA #1 - At work

quote:
Originally posted by Kirby
I'm too lazy to write an entire program solving this problem right now but I did it a few times before for my math hw (prgm in C++) so if you come up with a solution to your problem, and you have anything that doesn't work about it, post it up on the thread and I'd be happy to help you with something that doesn't work... I <3 C++... !!! ::wishes I was taking computer science this term::


i love C++ too.. unfortunately I am done with all my CS classes too..
now i am in love with assembly


___________________

get font

I see your 4 Crushs and raise you 3 As The Rush Comes. - Yan from PvD's first summerstage event in '03

Old Post Oct-08-2002 02:06  Germany
Click Here to See the Profile for drizzt81 Click here to Send drizzt81 a Private Message Add drizzt81 to your buddy list Report this Post Reply w/Quote Edit/Delete Message
drizzt81
Professional Lamer



Registered: Nov 2001
Location: GTA #1 - At work

quote:
Originally posted by PatMcGroin
ATLEAST YOUR NOT DOING C!!!!!!!

fucking a! i took c++ 2 years ago, and now i'm taking c....god so horrible! i fucking miss cin soooo much!

c is all harder with functions too, grrr

look at my last program i had to do:
http://www.cs.fsu.edu/~cgs3408/html/project5.htm

took me about 2 hours, but of course, with some help


C is simple. All I need is one book that explains what u get in the standard libraries.. then u will own that shit!

i like C. C++ is more fun, i admit.. Java is boring, nothing 'nifty', no pointers etc


___________________

get font

I see your 4 Crushs and raise you 3 As The Rush Comes. - Yan from PvD's first summerstage event in '03

Old Post Oct-08-2002 02:07  Germany
Click Here to See the Profile for drizzt81 Click here to Send drizzt81 a Private Message Add drizzt81 to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Trancealot
Supreme tranceaddict



Registered: Mar 2001
Location: Binghamton,ny--Roxy NYC!

#include
#include
#include
#include
using namespace ::std;
int main()
{
double x,n,r,f,fprime,error,a,b;
int d,iteration;

cout<<"input n: ";
cin>>n;
cout<<"input x: ";
cin>>x;
cout<<"input an initial guess at root, -1 if unsure: ";
cin>>r;
cout<<"input amount of decimal values: ";
cin>>d;
do{
if(r!=-1)
{
r=r;
}
else if(r==-1)
{
srand(r);
}
f=pow(r,n)-x;
fprime=n*pow(r,n-1);
a=x-(f/fprime);
b=a;
}while(a!=.01);
for(b=a;b=.01;b--)
for(iteration=1;iteration<=15;iteration++)

cout< cout< < return 0;
}


this is all the code I have produced...I am having major trouble in the do loop....that is what is messing me up....I need to produce when the user inputs all the values newton's method........as it does over and over in the do loop the program should print the iteration #,current estimate of the solution, and error(absolute of last estimate - current estimate) when it hits 0...this is due tomorrow please help!!


___________________
ATB -Let u go
Iio - Rapture(riva edit)
Dj Encore - I see right through you
Lasgo - something

The best vocal tunes on LI RIP(2001-2002)

Old Post Oct-08-2002 03:46  United States
Click Here to See the Profile for Trancealot Click here to Send Trancealot a Private Message Add Trancealot to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Trancealot
Supreme tranceaddict



Registered: Mar 2001
Location: Binghamton,ny--Roxy NYC!

it works on the complier but does not output anything...something wrong with the due loop..


___________________
ATB -Let u go
Iio - Rapture(riva edit)
Dj Encore - I see right through you
Lasgo - something

The best vocal tunes on LI RIP(2001-2002)

Old Post Oct-08-2002 03:48  United States
Click Here to See the Profile for Trancealot Click here to Send Trancealot a Private Message Add Trancealot to your buddy list Report this Post Reply w/Quote Edit/Delete Message
tranceaholic
chus & Ceballos addict



Registered: Mar 2002
Location: behind the decks

try to debug it..maybe by puting a cout in the loop to see what happens and if the loop is executing correctly or not...

Old Post Oct-08-2002 03:59  Egypt
Click Here to See the Profile for tranceaholic Click here to Send tranceaholic a Private Message Add tranceaholic to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Trancealot
Supreme tranceaddict



Registered: Mar 2001
Location: Binghamton,ny--Roxy NYC!

seems like I need to make a recursive loop of the
f=pow(r,n)-x;
fprime=n*pow(r,n-1);
a=x-(f/fprime);

because everytime it solves for A it needs to be plugged back inside the a to get a new a.


___________________
ATB -Let u go
Iio - Rapture(riva edit)
Dj Encore - I see right through you
Lasgo - something

The best vocal tunes on LI RIP(2001-2002)

Old Post Oct-08-2002 04:31  United States
Click Here to See the Profile for Trancealot Click here to Send Trancealot a Private Message Add Trancealot to your buddy list Report this Post Reply w/Quote Edit/Delete Message
drizzt81
Professional Lamer



Registered: Nov 2001
Location: GTA #1 - At work

mah friend, i gave u like 4 function definitions up there? WHY the HECK??? are you writing spaghetti code. This program would be so easy, if you used a 'top-down' approach to it, but u seem to hate writing functions. And yes, it is a GREAT application for recursive functions, if you want it to be (the CPU cache likes recursion, u know?)

anyhow, why are you computing a new random seed in the do loop?

why not use a while loop?

oh and 'error' is a reserved word, u shouldn't be using that as a variable...


___________________

get font

I see your 4 Crushs and raise you 3 As The Rush Comes. - Yan from PvD's first summerstage event in '03

Old Post Oct-08-2002 11:14  Germany
Click Here to See the Profile for drizzt81 Click here to Send drizzt81 a Private Message Add drizzt81 to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Trancealot
Supreme tranceaddict



Registered: Mar 2001
Location: Binghamton,ny--Roxy NYC!

my problem was I did not actually make algo's to calculate the table and that I have done by actually thinking finally....the newton's method is easy because it is a formula..but the hard part is making the repating algo's of the formula in the loop of going to .01 and subtracting the calculated value - current value....I will post up the working code today because I have half of it working good....amd LAB to finish it in


___________________
ATB -Let u go
Iio - Rapture(riva edit)
Dj Encore - I see right through you
Lasgo - something

The best vocal tunes on LI RIP(2001-2002)

Old Post Oct-08-2002 13:32  United States
Click Here to See the Profile for Trancealot Click here to Send Trancealot a Private Message Add Trancealot to your buddy list Report this Post Reply w/Quote Edit/Delete Message

TranceAddict Forums > Main Forums > Chill Out Room > C++ Hw
Post New Thread    Post A Reply

Pages (2): « 1 [2]  
Last Thread   Next Thread
Click here to listen to the sample!Pause playbackanother song from a DJ Lithium-Mix [2007] [1]

Click here to listen to the sample!Pause playbackDavid Guetta vs. The Egg - "Walking Away" (Tocadisco remix) [2007]

Show Printable Version | Subscribe to this Thread
Forum Jump:

All times are GMT. The time now is 10:49.

Forum Rules:
You may not post new threads
You may not post replies
You may not edit your posts
HTML code is ON
vB code is ON
[IMG] code is ON
 
Search this Thread:

 
Contact Us - return to tranceaddict

Powered by: Trance Music & vBulletin Forums
Copyright ©2000-2026, Jelsoft Enterprises Ltd.
Privacy Statement / DMCA
Support TA!