10 Discussion / Question Topics

Remove Filter
Member Avatar for
Member Avatar for VengefulToast

Hi, I have made a class and have an overloaded ostream operator method in it... However it tells me: "overloaded 'operator<<' must be a binary operator (has 3 parameters)." Can someone tell me how to fix this? Thank you! I have included some of my code: class Element { private: …

Member Avatar for Schol-R-LEA
0
461
Member Avatar for yxBen

Hi, I've been learning about the std::copy function in the <algorithm> header and I'm stuck on this exercise that I gave my self. Let's see the code snippet first: #include <iostream> #include <vector> #include <algorithm> #include <iterator> using namespace std; ostream& operator<<(ostream& os, const int p_val) { os.put( p_val*2); return …

Member Avatar for yxBen
0
482
Member Avatar for Nethran

Hi again! So, I have an object that gets appended to a linked list now. Now I need to have all of that item's data output in a formatted manner - something similar to this: CD Artist CD Title CD Length Track Name Track Length Arist name here Title here …

Member Avatar for Nethran
0
384
Member Avatar for coutnoob

Hi all and thanks in advance for your help ! I have a very simple class called circle and i wanna add the ostream << so i can have the ability in main to write cout<<a<<b<<c; the theme is i'm getting many compile errors in the same row eg iso …

Member Avatar for histrungalot
0
344
Member Avatar for beginneronce

Hey guys, i am a beginner in c++ and i don't know what's wrong with my code. i'dont get any errors, but when i run the programme the following: "... Line: 251 Expression: vector iterators incompatible ..." I think there is a problem with "b.getmark()" and "b.getcoursename()" but i don't …

Member Avatar for beginneronce
0
711
Member Avatar for livinFuture

Hello all. I am having difficulty getting my program to output data correctly. I have a class member function that is supposed to return the value of a specific member of a struct element based on identification with its (the struct element's) other members. [code] float MatrixType::valueAt(int i, int j) …

Member Avatar for livinFuture
0
195
Member Avatar for atiyehjoon

hello my dear friends I have read a book that was simple to learn c++,recently But in operator ovorloading threads ,I dont underestand many example for ovoreloading in another books & booklets for example : in the example below 1 // Fig. 11.3: PhoneNumber.h 2 // PhoneNumber class definition 3 …

Member Avatar for mike_2000_17
0
211
Member Avatar for George_91

I've to make several experiments of some algorithms. I want to send those results to a .txt file [CODE] //.... for (count= 1; count<= 20; count++){ //.... std::cout<<exp<<"Time: "<<duration << " seconds" <<'\n'; ofstream f2; f2.open("results.txt", ofstream::out); for(int i=0; i<=20; i++){ f2<<duration<<endl; } f2.close(); } [/CODE] With this code, I …

Member Avatar for MachDelta
0
179
Member Avatar for Sudo Bash

Hi all, I am trying to create a class to serve as a customized cout class. Right now I have made some test code to see if I can do it. Right now I am trying to make it function just like cout, but later I will have it do …

Member Avatar for Sudo Bash
0
2K
Member Avatar for BobTheLob

Hey, so i've looked around online for a bit, and after finding similar, but not exact (as in it doesn't help me), i'm gonna post my problem here :P. I'm working on a class to handle Complex numbers. This is going to require a lot of operator overloads and the …

Member Avatar for BobTheLob
0
253

The End.