Im just new in c++ [modified]
-
Dear All, I am still new in c++ i would like to implement this class how?? void main() } ;(A a1(1,1 ;(A a3(2,2 ;(A a3(0,0 a3=a1+a2; ++ a1 () a3.out a3=a1-a3 {() a3.out
Yes. CreatiVity withOuT limiTs
modified on Friday, December 11, 2009 3:57 PM
This doesn't look like C++ to me.
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) -
This doesn't look like C++ to me.
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) -
This doesn't look like C++ to me.
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++)I think he want's to port it over to C++, or maybe it's some sort of class diagram outlining functionality...
Check out the CodeProject forum Guidelines[^] The original soapbox 1.0 is back![^]
-
Dear All, I am still new in c++ i would like to implement this class how?? void main() } ;(A a1(1,1 ;(A a3(2,2 ;(A a3(0,0 a3=a1+a2; ++ a1 () a3.out a3=a1-a3 {() a3.out
Yes. CreatiVity withOuT limiTs
modified on Friday, December 11, 2009 3:57 PM
Do you want to convert
ASCII-art
intoC++
code? :-DIf the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Do you want to convert
ASCII-art
intoC++
code? :-DIf the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]yes, and without limits please. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
-
yes, and without limits please. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
#include <iostream> using namespace std; class A { private: int x; int y; public: A() { x = 0; y = 0; } A(int First, int Second) { x=First; y=Second; } // Opertator // A operator= ( A &oA); A operator- ( A oA); A operator+ ( A oA); A& operator++(int unu); // prefix int GetMyX() { return x; } int GetMyY() { return y; } void SetMyX(int Xvalue) { x=Xvalue; } void SetMyY(int Yvalue) { y=Yvalue; } void Out() { cout<<"Value Of x:" << GetMyX()<<" "<<"Value Of y:"<<GetMyY()<<endl ; } }; A A:: operator- (A oA) { oA.SetMyX (oA.GetMyX ()-x); oA.SetMyY (oA .GetMyY ()-y); return oA; } A A::operator+ (A oA) { oA.SetMyX (oA.GetMyX ()+x); oA.SetMyY (oA .GetMyY ()+y); return oA; } A& A::operator++(int temp) { SetMyX (GetMyX ()+1); SetMyY (GetMyY ()+1); return *this; } int main() { using namespace std; A a1(2,4); A a2(3,6); A a3(0,0); a1++; a1.Out (); a3=a1+a2; a3.Out (); a3=a1-a3; a3.Out (); int x; cin>>x; return 0; }
Yes. CreatiVity withOuT limiTs
-
Dear All, I am still new in c++ i would like to implement this class how?? void main() } ;(A a1(1,1 ;(A a3(2,2 ;(A a3(0,0 a3=a1+a2; ++ a1 () a3.out a3=a1-a3 {() a3.out
Yes. CreatiVity withOuT limiTs
modified on Friday, December 11, 2009 3:57 PM
Could you at least be bothered to fix this so it is legible? Did you use the Preview button before posting?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
#include <iostream> using namespace std; class A { private: int x; int y; public: A() { x = 0; y = 0; } A(int First, int Second) { x=First; y=Second; } // Opertator // A operator= ( A &oA); A operator- ( A oA); A operator+ ( A oA); A& operator++(int unu); // prefix int GetMyX() { return x; } int GetMyY() { return y; } void SetMyX(int Xvalue) { x=Xvalue; } void SetMyY(int Yvalue) { y=Yvalue; } void Out() { cout<<"Value Of x:" << GetMyX()<<" "<<"Value Of y:"<<GetMyY()<<endl ; } }; A A:: operator- (A oA) { oA.SetMyX (oA.GetMyX ()-x); oA.SetMyY (oA .GetMyY ()-y); return oA; } A A::operator+ (A oA) { oA.SetMyX (oA.GetMyX ()+x); oA.SetMyY (oA .GetMyY ()+y); return oA; } A& A::operator++(int temp) { SetMyX (GetMyX ()+1); SetMyY (GetMyY ()+1); return *this; } int main() { using namespace std; A a1(2,4); A a2(3,6); A a3(0,0); a1++; a1.Out (); a3=a1+a2; a3.Out (); a3=a1-a3; a3.Out (); int x; cin>>x; return 0; }
Yes. CreatiVity withOuT limiTs