No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
Anyway It seems to work fine it allocates space for everything.. But it does not put the value in. I have tested the value one statement before it is passed as an argument to the function and yet when I test it afterwards all the values are zero. So I … |
|
[CODE]#include <iostream> template<class T1, class T2> class TwoThings { T1 thing1; T2 thing2; public: TwoThings(T1 t1, T2 t2) : thing1(t1), thing2(t2) {} template<class T3, class T4> friend std::ostream& operator<<(std::ostream& os, const TwoThings<T3, T4)&); }; template<class T1, class T2> std::ostream&::operator<<(std::ostream& os, const TwoThings<T1, T2>& tt) { std::cout<<tt.thing1<<' '<<tt.thing2; return os; } … |
|
I am trying to make a custom stream class because for some reason standard string objects crash my program when i try to output them, i believe i know why now. When i tried to overload the << operator for a string object by making it a friend of my … |
|
Re:
i can't write a code for a program.Please help me guys. It goes like this: Create a program that displays the total amount a company owes for a seminar.The seminar rate is $80/person. The input is the seminar rate and the number of seminar registrants,which should be greater than 0 … |