C++ problem

Closed Thread

Join Date: Jan 2005
Posts: 25
Reputation: seeplusplus is an unknown quantity at this point 
Solved Threads: 0
seeplusplus seeplusplus is offline Offline
Light Poster

C++ problem

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




  1. #include <iostream>
  2.  
  3. using std::cout;
  4. using std::cin;
  5. using std::endl;
  6.  
  7. class rational {
  8.  
  9. public:
  10. rational();
  11. ~rational();
  12. int setrat( int x, int y);
  13. int getnum();
  14. int getdenom();
  15.  
  16.  
  17. private:
  18.  
  19. int numerator;
  20. int denominator;
  21.  
  22.  
  23. }; // end of rational class
  24.  
  25. rational::rational()
  26. {
  27. numerator = 1;
  28. denominator = 1;
  29. }
  30. int rational::setrat( int x, int y)
  31. {
  32. numerator = x;
  33. denominator = y;
  34. }
  35. int rational::getnum()
  36. {
  37. return (numerator);
  38. }
  39. int rational::getdenom()
  40. {
  41. return (denominator);
  42. }
  43.  
  44.  
  45. #include "Rationall.h"
  46.  
  47. int main()
  48. {
  49. int x, y;
  50. rational rationl;
  51.  
  52. cout << "Enter in a fraction" << endl;
  53. cout << "Enter in the numerator" << endl;
  54. cin >> x;
  55. cout << "Enter in the denominator" << endl;
  56. cin >> y;
  57.  
  58. rationl.setrat( x, y );
  59.  
  60. cout << "The fraction: " << endl;
  61. cout << rationl.getnum() << rationl.getdenom() << endl;
  62.  
  63. return 0;
  64. }
Quick reply to this message  
Join Date: Apr 2004
Posts: 4,780
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 308
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: C++ problem

 
0
  #2
Feb 9th, 2005
Me, too. (I don't have the file "Rationall.h" -- do you?)
β€œThe essential notion of a socialist society is force.”
β€” Milton Friedman
Quick reply to this message  
Join Date: Feb 2005
Posts: 30
Reputation: Intel is an unknown quantity at this point 
Solved Threads: 1
Intel Intel is offline Offline
Light Poster

Re: C++ problem

 
0
  #3
Feb 9th, 2005
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;
}
Quick reply to this message  
Join Date: Nov 2004
Posts: 108
Reputation: prog-bman is an unknown quantity at this point 
Solved Threads: 3
prog-bman prog-bman is offline Offline
Junior Poster

Re: C++ problem

 
0
  #4
Feb 10th, 2005
Intel,
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.
Quick reply to this message  
Join Date: Dec 2003
Posts: 2,417
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Solved Threads: 125
Team Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

Re: C++ problem

 
0
  #5
Feb 10th, 2005
Originally Posted by prog-bman
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.
Alex Cavnar, aka alc6379
Quick reply to this message  
Join Date: Sep 2004
Posts: 8,313
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 824
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: C++ problem

 
1
  #6
Feb 10th, 2005
>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.
In case you were wondering, yes, I do hate you.
Quick reply to this message  
Join Date: Apr 2004
Posts: 353
Reputation: Asif_NSU is on a distinguished road 
Solved Threads: 2
Asif_NSU's Avatar
Asif_NSU Asif_NSU is offline Offline
Posting Whiz

Re: C++ problem

 
0
  #7
Feb 11th, 2005
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.
Quick reply to this message  
Join Date: Sep 2004
Posts: 8,313
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 824
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: C++ problem

 
0
  #8
Feb 11th, 2005
>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.
In case you were wondering, yes, I do hate you.
Quick reply to this message  
Join Date: Apr 2004
Posts: 353
Reputation: Asif_NSU is on a distinguished road 
Solved Threads: 2
Asif_NSU's Avatar
Asif_NSU Asif_NSU is offline Offline
Posting Whiz

Re: C++ problem

 
0
  #9
Feb 11th, 2005
Originally Posted by Narue
>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".
Quick reply to this message  
Join Date: Sep 2004
Posts: 8,313
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 824
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: C++ problem

 
0
  #10
Feb 11th, 2005
>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.
In case you were wondering, yes, I do hate you.
Quick reply to this message  
Closed Thread

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum


Views: 1991 | Replies: 9
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC