473,320 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Student is Desperate

What the heck is wrong with this:

#ifndef POLYNOMIAL_H
#define POLYNOMIAL_H
class Polynomial {
public:
Polynomial();
Polynomial operator+( const Polynomial& ) const; // addition
Polynomial operator-( const Polynomial& ) const; // subtraction
Polynomial operator*( const Polynomial& ); // multiplication
const Polynomial operator=( const Polynomial&);// assignment
Polynomial& operator+=( const Polynomial& );
Polynomial& operator-=( const Polynomial& );
Polynomial& operator*=( const Polynomial& );
void enterTerms();
void printPolynomial() const;
private:
int exponents[ 100 ]; // exponent array
int coefficients[ 100 ]; // coefficients array
void polynomialCombine( Polynomial& ); // combine common terms
}; // end class Polynomial
#endif
#include <iostream>

using std::cout;
using std::endl;

#include "Polynomial.h"
int main()
{
Polynomial a, b, c, t;

a.enterTerms();
b.enterTerms();
t = a; // save the value of a
cout << "First polynomial is:\n";
a.printPolynomial();
cout << "Second polynomial is:\n";
b.printPolynomial();
cout << "\nAdding the polynomials yields:\n";
c = a + b;
c.printPolynomial();
cout << "\n+= the polynomials yields:\n";
a += b;
a.printPolynomial();
cout << "\nSubtracting the polynomials yields:\n";
a = t; // reset a to original value
c = a - b;
c.printPolynomial();
cout << "\n-= the polynomials yields:\n";
a -= b;
a.printPolynomial();
cout << "\nMultiplying the polynomials yields:\n";
a = t; // reset a to original value
c = a * b;
c.printPolynomial();
cout << "\n*= the polynomials yields:\n";
a *= b;
a.printPolynomial();
cout << endl;
return 0;
} // end main
C:\Documents and Settings\Owner\connie marshall's week 7
homework.cpp(32) : fatal error C1083: Cannot open include file:
'Polynomial.h': No such file or directory

The question is:

Using C++ language to complete this homework

1. Develop class Polynomial. The internal representation of a
Polynomial is an array of terms. Each term contains a coefficient and
an exponent. The term

2x4
has the coefficient 2 and the exponent 4. Develop a complete class
containing proper constructor functions as well as set and get
functions. The class should also provide the following overloaded
operator capabilities:

(a) Overload the addition operator (+) to add two Polynomials.
(b) Overload the multiplication operator (*) to multiply two
Polynomials.
(c) Overload the subtraction assignment operator (-) to process two
Polynomials
(d) Overlaod the assignment operator to assign one polynomial to
another
(e) Overload the addition assignment operator (+=), subtraction
assignment operator (-=), and multiplication assignment operator(*=).

I'm going crazy here. Please help.

Aug 11 '06 #1
5 3729
beachlounger wrote:
What the heck is wrong with this:

C:\Documents and Settings\Owner\connie marshall's week 7
homework.cpp(32) : fatal error C1083: Cannot open include file:
'Polynomial.h': No such file or directory
Do you have a file called C:\Documents and Settings\Owner\Polynomial.h ?

If not, put the stuff between #ifdef and #endif into it, inclusive.
I'm going crazy here. Please help.
Your next tip is to form a study group with your classmates.

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Aug 11 '06 #2
* be**********@aol.com:
What the heck is wrong with this:

#ifndef POLYNOMIAL_H
#define POLYNOMIAL_H
class Polynomial {
public:
Polynomial();
Polynomial operator+( const Polynomial& ) const; // addition
Polynomial operator-( const Polynomial& ) const; // subtraction
Polynomial operator*( const Polynomial& ); // multiplication
const Polynomial operator=( const Polynomial&);// assignment
Polynomial& operator+=( const Polynomial& );
Polynomial& operator-=( const Polynomial& );
Polynomial& operator*=( const Polynomial& );
void enterTerms();
void printPolynomial() const;
private:
int exponents[ 100 ]; // exponent array
int coefficients[ 100 ]; // coefficients array
void polynomialCombine( Polynomial& ); // combine common terms
}; // end class Polynomial
#endif
#include <iostream>

using std::cout;
using std::endl;

#include "Polynomial.h"
int main()
{
Polynomial a, b, c, t;

a.enterTerms();
b.enterTerms();
t = a; // save the value of a
cout << "First polynomial is:\n";
a.printPolynomial();
cout << "Second polynomial is:\n";
b.printPolynomial();
cout << "\nAdding the polynomials yields:\n";
c = a + b;
c.printPolynomial();
cout << "\n+= the polynomials yields:\n";
a += b;
a.printPolynomial();
cout << "\nSubtracting the polynomials yields:\n";
a = t; // reset a to original value
c = a - b;
c.printPolynomial();
cout << "\n-= the polynomials yields:\n";
a -= b;
a.printPolynomial();
cout << "\nMultiplying the polynomials yields:\n";
a = t; // reset a to original value
c = a * b;
c.printPolynomial();
cout << "\n*= the polynomials yields:\n";
a *= b;
a.printPolynomial();
cout << endl;
return 0;
} // end main
C:\Documents and Settings\Owner\connie marshall's week 7
homework.cpp(32) : fatal error C1083: Cannot open include file:
'Polynomial.h': No such file or directory

The question is:

Using C++ language to complete this homework

1. Develop class Polynomial. The internal representation of a
Polynomial is an array of terms. Each term contains a coefficient and
an exponent. The term
You're missing the file [Polynomial.h].

The assignment seems to be to create that file.

And possibly also an implementation file [Polynomial.cpp].
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Aug 11 '06 #3

<be**********@aol.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
>
C:\Documents and Settings\Owner\connie marshall's week 7
homework.cpp(32) : fatal error C1083: Cannot open include file:
'Polynomial.h': No such file or directory

The question is:

Using C++ language to complete this homework
Your assignment really has nothing to do with the error message. Read it.
It says it can't find the file "Polynomial.h". If that file exists, is it
in the correct directory? Is it spelled correctly? Does your compiler know
where to look for it? You may need to add it to your project, or add the
directory where it is stored to some kind of search path in your compiler or
project settings.

Answers to problems like that are best gotten from a newsgroup devoted to
your compiler, not from this language newsgroup.

-Howard

Aug 11 '06 #4

be**********@aol.com wrote:
I'm going crazy here.

Congratulations!!!

Aug 11 '06 #5
be**********@aol.com wrote:
What the heck is wrong with this:

#ifndef POLYNOMIAL_H
#define POLYNOMIAL_H
class Polynomial {
public:
Polynomial();
Polynomial operator+( const Polynomial& ) const; // addition
Polynomial operator-( const Polynomial& ) const; // subtraction
Polynomial operator*( const Polynomial& ); // multiplication
const Polynomial operator=( const Polynomial&);// assignment
Polynomial& operator+=( const Polynomial& );
Polynomial& operator-=( const Polynomial& );
Polynomial& operator*=( const Polynomial& );
void enterTerms();
void printPolynomial() const;
private:
int exponents[ 100 ]; // exponent array
int coefficients[ 100 ]; // coefficients array
void polynomialCombine( Polynomial& ); // combine common terms
}; // end class Polynomial
#endif
Cut here and paste the above text into Polynomial.h.
>

#include <iostream>

using std::cout;
using std::endl;

#include "Polynomial.h"
int main()
{
Polynomial a, b, c, t;

a.enterTerms();
b.enterTerms();
t = a; // save the value of a
cout << "First polynomial is:\n";
a.printPolynomial();
cout << "Second polynomial is:\n";
b.printPolynomial();
cout << "\nAdding the polynomials yields:\n";
c = a + b;
c.printPolynomial();
cout << "\n+= the polynomials yields:\n";
a += b;
a.printPolynomial();
cout << "\nSubtracting the polynomials yields:\n";
a = t; // reset a to original value
c = a - b;
c.printPolynomial();
cout << "\n-= the polynomials yields:\n";
a -= b;
a.printPolynomial();
cout << "\nMultiplying the polynomials yields:\n";
a = t; // reset a to original value
c = a * b;
c.printPolynomial();
cout << "\n*= the polynomials yields:\n";
a *= b;
a.printPolynomial();
cout << endl;
return 0;
} // end main
C:\Documents and Settings\Owner\connie marshall's week 7
homework.cpp(32) : fatal error C1083: Cannot open include file:
'Polynomial.h': No such file or directory

The question is:

Using C++ language to complete this homework

1. Develop class Polynomial. The internal representation of a
Polynomial is an array of terms. Each term contains a coefficient and
an exponent. The term

2x4
has the coefficient 2 and the exponent 4. Develop a complete class
containing proper constructor functions as well as set and get
functions. The class should also provide the following overloaded
operator capabilities:

(a) Overload the addition operator (+) to add two Polynomials.
(b) Overload the multiplication operator (*) to multiply two
Polynomials.
(c) Overload the subtraction assignment operator (-) to process two
Polynomials
(d) Overlaod the assignment operator to assign one polynomial to
another
(e) Overload the addition assignment operator (+=), subtraction
assignment operator (-=), and multiplication assignment operator(*=).

I'm going crazy here. Please help.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book
http://www.sgi.com/tech/stl -- Standard Template Library

Aug 12 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mojo | last post by:
Ok, I don't want to much help but I need a push. I am supposed to write a program with 3 classes: 1. Controlling class 2. Student class 3. Grades class Controlling class instantiates a student...
16
by: Kirk Bevins | last post by:
Hello, new to posting, got a dilema in c++. I cant seem to create new instances of my student class. The idea is to make a database where the user inputs surnames and library card numbers etc. The...
6
by: laj | last post by:
HI, Excuse this new question, I am trying to impress my wife by putting a db together for her dance studio. I put a table with all students new and old with fields including name and address and...
2
by: sallyk07 | last post by:
Modify the Student class so that each student object should also contain the scores for three tests. Provide a constructor that sets all instance values based on parameter values. Overload the...
4
by: Dave White | last post by:
Hello Everyone, I have created two tables to track my students' lessons. Each student is responsible for most, but not all. of the lessons. I've tried a junction table but I can't figure out...
11
by: xxbabysue123xx | last post by:
Heres the problem: Create a class Student with instance data name, studentNumber, class (where class is a String containing one of the following: “Freshman”, “Sophomore”, “Junior”, “Senior”. ...
3
by: Synapse | last post by:
hi everyone..im trying to create a student list program using linked list that will display all my info of students..but it seems theres a little prob. after i enter my first student the program will...
4
by: withu4ever | last post by:
I learned how to use struct when I try to write a program i face some misstakes which I cant correct This is the program: ------------------------------------------------------- ...
1
by: =?Utf-8?B?UGF0c3k=?= | last post by:
Hi I recently purchased my new laptop with Trial Version of Student & Home Office 07. Having activated it (following all the instructions) I cannot actually use it. I cannot input information of...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.