Beginners - November 2017 (Page 19)

I just need help on a question for the book I have on overloaded operators.
 
Assuming a class needs to have conversion capabilities, what can you do in the class design to get rid of the problem for conversion operators? I am having a...
[no replies]
How to return a copy to keep my data safe?
 
Hello, I am practicing algorithms. I want to know how could I return a std::vector in a safe way, such that others have no right to modify it? I use const befo...
[4 replies] Last: When you return anything which is not a reference, the result is a cop... (by mbozzi)
VExpress not running last piece of code
 
I'm pretty green at programming in general but am completely baffled as to why the last bit of code isn't working. I'm going through Principles and Practice us...
[7 replies] Last: No, it will never reach the break statement (line 17, following the if... (by lastchance)
What is the correct way to initialize the vector member variable of the class?
 
What is the correct way to initialize the vector member variable of the class? Do we have to initialize it at all? // Method one class ClassName { publ...
[1 reply] : No initialisation needed. It's a fully formed size zero vector, ready ... (by Repeater)
Math Operations in If Then Statements Not Working
 
So, I'm trying to make a simple console based calculator for fun. However, when I use multiple if then statements with my string operation, it only returns addi...
[2 replies] Last: thank you sir, that was very helpful. my problem is solved. I changed ... (by UnrealKnite)
operator overloading?
 
Hi guys I'm just wondering why do we need to return a reference when overloading an operator such as =,I tried returning an object and it still worked but when ...
[3 replies] Last: When you return a reference, that reference refers to the current obje... (by Chervil)
Classes: Alarm Clock
 
This is what I have so far... I need to: In the main function, write statements to call setAlarmClock to set the time to all zeros, and call getAlarmClock to ge...
[5 replies] Last: Ok that's what I thought... didn't know if it was possible to do it th... (by nicoleb)
Need help
 
I'm not sure if this kind of discussion is allowed here but I'm desperate and need help I'm new to programming and an eager learner I have been trying to co...
[3 replies] Last: #include <iostream> using namespace std; int main() { int rows; ... (by Manga)
Help in designing code
 
Dear all, I have to write a numerical simulation, for which I have created a class called "Organism" which I call each time an organism is created in the sim...
[3 replies] Last: One option would be to use a Singleton to store the constants so each ... (by Thomas1965)
how to edit the input file
 
i have a text file which has a destination of some files. it is as below. "E:\Feature\raw\new\frameSplit62.png" i have many photos and i want a c++ code ...
[7 replies] Last: @JLBorges can you help me to edit your code to give an txt file output... (by gayaumesh)
by Baluv3
Two dimensional string array display problem
 
I want a string to be displayed from a two dimensional array. But the output shows only the first part i.e before the space present in the string. i/p : Brea...
[4 replies] Last: After cin>>icount; (line 31) there will be a trailing newline '\... (by Chervil)
Help With c++ HW
 
Seeing as how I cant reply for whatever reason ill post here. Thank you repeater for your help.
[1 reply] : You are passing, to your functions, copies of variables. This is kno... (by Repeater)
Removing items from an array without loss of data
 
Hello! I am having some trouble with a void function with the purpose of removing an entry in an array that is searched for, and pushing all of those beyond tha...
[2 replies] Last: what kind of arrays? dynamic,static. i would suggest but not limit you... (by closed account SECMoG1T)
Problem with using libraries
 
Hello, I downloaded Dicom toolkit and followed the instructions (http://support.dcmtk.org/docs/file_install.html). I created header files by Cmake but for...
[1 reply] : If your #include statement says dcmtk/dcmimgle/dimoimg.h then the co... (by Repeater)
by Delcho
Problems with files in c++
 
Can someone help me? There are problems in void write() and void update() after the first if. #include<iostream> #include<fstream> #include<string> usi...
[19 replies] Last: I found my mistake and it is the ; after the while (by Delcho)
number of mines not accurate
 
I'm developing a simple minesweeper using 2d arrays in c++. However I am stuck at a point where the program seems to count the mines correctly for the most pa...
[4 replies] Last: I got it Thanks a bunch (by arsalazhar336)
by Delcho
Help
 
Can someone tell me why after the line: cout<<"Enter title for search: "; the console is waiting to enter a symbol but I can't With or without cin.get() is the ...
[8 replies] Last: Yeah, it helped me thank you so much! (by Delcho)
Help with lucky square? c++
 
I'm trying to create a lucky square. A lucky sequence means that every number after the first two is the sum of the two preceding number. A lucky square means t...
[1 reply] : You should only input the first two rows and columns (lines 14-17). Ev... (by lastchance)
so im making an else if statement, but when i try to run it i get this [error] 'else' without previous 'if'
 
//choice1 cout<<"choices"<<endl; cout<<"A: try to leave an impression B: normal introduction"<<endl; cin>>choice1; if (choice1=="A"); { cout<...
[1 reply] : Your biggest mistake is putting the semicolon after the if and else i... (by closed account 1vf9z8AR)
C++ static &polymorphism question
 
Hi guys I have this question from my past exams. Is the following statement true or false? Static methods can not be virtual. Thus, they are not polymorphic...
[2 replies] Last: thank you man (by swapnil1920)
November 2017 Pages: 1... 1718192021... 33
  Archived months: [oct2017] [dec2017]

This is an archived page. To post a new message, go to the current page.