| | |
C++ problem
![]() |
•
•
Join Date: Jan 2005
Posts: 25
Reputation:
Solved Threads: 0
when i compile this, it gives me an error for my #include "Rationall.h" statement........i dont know why its giving me an error.
C++ Syntax (Toggle Plain Text)
#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; }
•
•
Join Date: Feb 2005
Posts: 30
Reputation:
Solved Threads: 1
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;
}
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;
}
•
•
Join Date: Nov 2004
Posts: 108
Reputation:
Solved Threads: 3
Intel,
Let dave comment as he wishes and use code tags.
Let dave comment as he wishes and use code tags.
Join me on IRC:
Server: irc.daniweb.com
Channel: #C++
Chat Via:
http://daniweb.com/chat/minichat.php
or
Your favorite IRC client.
Server: irc.daniweb.com
Channel: #C++
Chat Via:
http://daniweb.com/chat/minichat.php
or
Your favorite IRC client.
>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.
<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.
In case you were wondering, yes, I do hate you.
![]() |
Similar Threads
- Problem with Windows Update and WinXP (Web Browsers)
- Installing Windows 98 On VMware. Floppy problem (Windows 95 / 98 / Me)
- Windows XP keeps restarting since a new video card (Windows NT / 2000 / XP)
- Redhat Linux 6.2 - ipop3d problem? (*nix Software)
- Problem with T720 (Cellphones, PDAs and Handheld Devices)
- Connection Problems (Networking Hardware Configuration)
- Encoding (Unicode) problem in IE 6.0 (Web Browsers)
- .htaccess mod_rewrite problem (Linux Servers and Apache)
- Javascript/HTML problem!!! (JavaScript / DHTML / AJAX)
Other Threads in the C++ Forum
- Previous Thread: Console-input echo trouble
- Next Thread: Checkbook assignment help
Views: 1991 | Replies: 9
| Thread Tools | Search this Thread |
Tag cloud for C++
6 algorithm api array arrays assignment beginner binary c++ c++borland c/c++ calculator char class classes code compile compiler constructor conversion convert count delete dll dynamic encryption error file files filestream form forms fstream function functions game givemetehcodez graph graphics gui homework iamthwee input int integer lazy linker list loop math matrix member memory network newbie news number object objects opengl operator output parameter pointer pointers problem program programming project qt random read recursion recursive reference return search server sort spoonfeeding string strings struct student studio template templates text time tree variable vc++ vector video visual win32 window windows winsock wxwidgets





