HEY YOU!!!, Our records indicate that you have never posted to our site before! Why not make your first post today by saying hello to our community in our new people forums. To access all the good good stuff you need to post, post, and post more.


Support Webrats Forum with your Subscription. Only $5.95 per month!
Adult lounge Access • Private Messaging • GAMES •
Please click here for more details • Please click here to subscribe
Go Back   WR > Community > Computers and Programming
User Name
Password
Register Help Desk Music Uploads Live Cams Arcade Upgrade Account Mark Forums Read
Reply
 
Thread Tools
Old 05-14-2004, 06:49 AM   #1
mahtmdtlb182
Guest
 
Posts: n/a/0
Threads:
This is an interesting section

click on one of our sponsors! OR REMOVE ADS
Would i be able to get any C++ help from here?

That would be really sweet :rock:
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Spurl | quote |
Sponsored Links
REMOVE ADS
Old 05-14-2004, 07:53 AM   #2
the_lone_bard
whore
 
 
Join Date: Feb 2004
Location: Ontario Canada
Posts: 719/0.41
Threads: 1
MALE
Re: This is an interesting section

ask?
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Spurl | quote |
Old 05-15-2004, 04:36 PM   #3
mahtmdtlb182
Guest
 
Posts: n/a/0
Threads:
Re: This is an interesting section

I might need help with a couple of programs, is that too much to ask?
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Spurl | quote |
Old 05-15-2004, 06:48 PM   #4
Snippy
whore
 
 
Join Date: May 2004
Location: Dunno
Posts: 171/0.10
Threads: 0
MALE
Re: This is an interesting section

No.. but what he meant was "why dont you ask directly".. i dont use c++.. but im quite sure someone will help u

Greetz
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Spurl | quote |
Old 05-16-2004, 12:08 AM   #5
alleon86
Guest
 
Posts: n/a/0
Threads:
Re: This is an interesting section

C++ is harder than u thought
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Spurl | quote |
Sponsored Links
REMOVE ADS
Old 05-16-2004, 11:49 AM   #6
mcgyver420
Guest
 
Posts: n/a/0
Threads:
Re: This is an interesting section

I failed C++ in college. Was very tough.
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Spurl | quote |
Old 05-16-2004, 09:03 PM   #7
Neo7751
whore
 
 
Join Date: May 2004
Location: Florida
Posts: 12/0.01
Threads: 0
MALE
Re: This is an interesting section

I know C, but very little of C++...sorry I can't help.
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Spurl | quote |
Old 05-17-2004, 01:44 AM   #8
Esco
whore
 
 
Join Date: May 2004
Location: Right Behind You
Posts: 760/0.46
Threads: 0
MALE
Re: This is an interesting section

Heh .. I took c++ about 4 years ago ... along with some other languages that I've forgotten.

I might still have my book. I'd suggest you ask a specific question and see if someone can answer.

good luck.
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Spurl | quote |
Old 05-17-2004, 02:46 AM   #9
mahtmdtlb182
Guest
 
Posts: n/a/0
Threads:
Re: This is an interesting section

You are to write a program that finds the rational number that is nearest to that number.

You should use code that you developed in CS1 or download the following interface (header) and implementation files for the rational number class: rational.h and rational.cpp.

Your assignment is to use modify this class and create a client program designed to locate a rational number < 1 that is an approximation to (PI - 3). Design methods for the class that support finding a solution and creating clear interface for the client.

As a first experiment repeatedly choose a random rational number <1 and test to see how close it is. How close can you get after 1000 iterations? How close can you get after 1,000,000 iterations? Finally, come up with an algorithm that does better than the random guess method you just tried. Run it for 1000 iterations, then for 1.000.000. How much better is your algorithm in each experiment? Submit these results as comments.
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Spurl | quote |
Sponsored Links
REMOVE ADS
Old 05-17-2004, 02:46 AM   #10
mahtmdtlb182
Guest
 
Posts: n/a/0
Threads:
Re: This is an interesting section

oh yeah here is rational.h

// rational.h: declaration of Rational ADT
#ifndef RATIONAL_H
#define RATIONAL_H
#include <iostream>
// Rational ADT: class description

using namespace std;

class Rational {
public: // member functions
// constructors
Rational();
Rational(int numer, int denom = 1);
// some arithmetic and stream facilitators
Rational Add(const Rational &r) const;
Rational Multiply(const Rational &r) const;
void Insert(ostream &sout) const;
void Extract(istream &sin);
protected:
// inspectors
int Numerator() const;
int Denominator() const;
// mutators
void SetNumerator(int numer);
void SetDenominator(int denom);
private:
// data members
int NumeratorValue;
int DenominatorValue;
};
// Rational ADT: auxiliary operator description
Rational operator+(const Rational &r,
const Rational &s);
Rational operator*(const Rational &r,
const Rational &s);
ostream& operator<<(ostream &sout, const Rational &s);
istream& operator>>(istream &sin, Rational &r);
#endif
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Spurl | quote |
Old 05-17-2004, 02:47 AM   #11
mahtmdtlb182
Guest
 
Posts: n/a/0
Threads:
Re: This is an interesting section

and rational.cpp

//IMPLEMENTATION OF THE RATIONAL CLASS
#include <iostream>
#include "rational.h"
// default constructor
Rational::Rational() {
SetNumerator(0);
SetDenominator(1);
}
// (numer, denom) constructor
Rational::Rational(int numer, int denom) {
SetNumerator(numer);
SetDenominator(denom);
}
// get the numerator
int Rational::Numerator() const {
return NumeratorValue;
}
// get the denominator
int Rational::Denominator() const {
return DenominatorValue;
}
// set the numerator
void Rational::SetNumerator(int numer) {
NumeratorValue = numer;
}
// set the denominator
void Rational::SetDenominator(int denom) {
if (denom != 0)
DenominatorValue = denom;
else {
cerr << "Illegal denominator: " << denom
<< "using 1" << endl;
DenominatorValue = 1;
}
}
// adding Rationals
Rational Rational::Add(const Rational &r) const {
int a = Numerator();
int b = Denominator();
int c = r.Numerator();
int d = r.Denominator();
return Rational(a*d + b*c, b*d);
}
// multiplying Rationals
Rational Rational::Multiply(const Rational &r) const {
int a = Numerator();
int b = Denominator();
int c = r.Numerator();
int d = r.Denominator();
return Rational(a*c, b*d);
}
// inserting a Rational
void Rational::Insert(ostream &sout) const {
sout << Numerator() << '/' << Denominator();
return;
}
// extracting a Rational
void Rational::Extract(istream &sin) {
int numer;
int denom;
char slash;
sin >> numer >> slash >> denom;
SetNumerator(numer);
SetDenominator(denom);
return;
}
// adding Rationals
Rational operator+(const Rational &r,
const Rational &s) {
return r.Add(s);
}
// multiplying Rationals
Rational operator*(const Rational &r,
const Rational &s) {
return r.Multiply(s);
}
// inserting a Rational
ostream& operator<<(ostream &sout, const Rational &r) {
r.Insert(sout);
return sout;
}
// extracting a Rational
istream& operator>>(istream &sin, Rational &r) {
r.Extract(sin);
return sin;
}
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Spurl | quote |
Old 05-17-2004, 02:47 AM   #12
mahtmdtlb182
Guest
 
Posts: n/a/0
Threads:
Re: This is an interesting section

think you can help?
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Spurl | quote |
Old 05-17-2004, 03:02 AM   #13
aquadude
whore
 
 
Join Date: May 2004
Location: peeing in the pool
Posts: 881/0.53
Threads: 3
MALE
Re: This is an interesting section

Looks like you have to write a program that returns 0.1415926....

Doesn't look like it takes any input, so write a program that calculates pi and subtracts 3 from the end result. Or you can try to calculate that decimal straight up, but I don't know the answer to that.

Try searching around google for a rational way to derive pi. I know that one exists.

The header and .cpp file look simple. I think the hardest part is knowing how to derive pi by the iteration of dividing 2 numbers.
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Spurl | quote |
Sponsored Links
REMOVE ADS
Old 05-17-2004, 03:25 PM   #14
spinz2112
Guest
 
Posts: n/a/0
Threads:
Re: This is an interesting section

This looks like some hw to me!! Shouldnt it be your own work?
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Spurl | quote |
Old 05-18-2004, 03:12 PM   #15
pr0hawk
Guest
 
Posts: n/a/0
Threads:
Re: This is an interesting section

I hate people who make other people do their homework. Especially on the forums!
Submit to Clesto Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Spurl | quote |
Reply

WR > Community > Computers and Programming
Reload this Page This is an interesting section
Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:

Powered by Waldo 12345678910 1213 14 15 Copyright © 2000-2005 Jelsoft Enterprises Limited.
Page generated in 1.22421694 seconds (95.66% PHP - 4.34% MySQL) with 11 queries
206.212.255.30 Message Boards and Forums Directory