when i compile this, it gives me an error for my #include "Rationall.h" statement........i dont know why its giving me an error.

#include <iostream>

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

class rational {

public:
rational();    
~rational();   
int setrat( int x, int y);   
int getnum();   
int getdenom();  


private:

int numerator;
int denominator;


}; // end of rational class

rational::rational()   
{
numerator = 1;
denominator = 1;
}  
int rational::setrat( int x, int y)   
{
numerator = x;
denominator = y;  
}  
int rational::getnum()   
{
return (numerator);
}   
int rational::getdenom()   
{
return (denominator);
}  


#include "Rationall.h"

int main()
{
   int x, y;
   rational rationl;  

   cout << "Enter in a fraction" << endl;
   cout << "Enter in the numerator" << endl;
   cin >> x;
   cout << "Enter in the denominator" << endl;
   cin >> y;

   rationl.setrat( x, y );

   cout << "The fraction: " << endl;
   cout << rationl.getnum() << rationl.getdenom() << endl;

   return 0;              
}

Recommended Answers

All 9 Replies

Me, too. (I don't have the file "Rationall.h" -- do you?)

Dave,
Be nice to people, either answer their Q's or simply dont make fun of them, please.
-----------------
Save this in a file called Rationall.h

#include <iostream>

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

class rational {

public:
rational();
~rational();
int setrat( int x, int y);
int getnum();
int getdenom();


private:

int numerator;
int denominator;


}; // end of rational class

rational::rational()
{
numerator = 1;
denominator = 1;
}
int rational::setrat( int x, int y)
{
numerator = x;
denominator = y;
}
int rational::getnum()
{
return (numerator);
}
int rational::getdenom()
{
return (denominator);
}
-------------
Save this in a file called Main.cpp

#include "Rationall.h"

int main()
{
using namespace std;
int x, y;
rational rationl;

cout << "Enter in a fraction" << endl;
cout << "Enter in the numerator" << endl;
cin >> x;
cout << "Enter in the denominator" << endl;
cin >> y;

rationl.setrat( x, y );

cout << "The fraction: " << endl;
cout << rationl.getnum() << rationl.getdenom() << endl;

return 0;
}

Intel,
Let dave comment as he wishes and use code tags.

Intel,
Let dave comment as he wishes and use code tags.

Exactly.

You're not really helping by writing their code for them-- that's helping folks cheat.

Don't be a crutch.

>Be nice to people, either answer their Q's or simply dont make fun of them, please.
<NOPOST>
Analyzing...

Dave Sinkula:
583 posts
Known guru
Nice and helpful

Intel:
11 posts
Does not seem very bright
Nice and gullible

Conclusion:
User "Intel" tries to act smart and pretend he knows what he is doing
User "Dave Sinkula" actually helps people

Searching database for appropriate response to user "Intel"...
</NOPOST>
Dave did answer the question. You're just not smart enough to look beyond your own ego and see it. Get over yourself, read the rules, and shut the hell up until you can post a quality response.

commented: for your whole activity +1

There is no need to be so harsh on intel, he is just starting out. He should have his freedom of speech and all these hostile responses wont make that easy.

>He should have his freedom of speech
So should we. Everyone has a different style of teaching, and it's not Intel's place to dictate how we help people on a public voluntary forum.

>He should have his freedom of speech
So should we. Everyone has a different style of teaching, and it's not Intel's place to dictate how we help people on a public voluntary forum.

To me it sounded more like a request not a "dictation".

>To me it sounded more like a request not a "dictation".
Just because a sentence fragment is terminated with "please" doesn't make the entire statement a request.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.