General C++ Programming - May 2017 (Page 9)

by Kalcor
if-else if issue
 
Uhm I encountered a weird error that happened within these 2 codes: int step = 1; for(int i = 0; i < n; i++) { //cout << step << " "; if(s...
[1 reply] : In the second example, there are separate if statements that all get e... (by wildblue)
Checking equality of two pointer addresses is not working
 
In function isEqualTo I'm checking equality of two addresses of one object pointer, but somehow addresses don't match. Can someone solve me this problem? Thanks...
[2 replies] Last: Thank you :)! I'm very bad with pointers :(. (by Putarda)
Base class doesn't want to delete.
 
I made mini code to just demonstrate what is my problem. So if an object is created and if initialization goes wrong, then the whole object will be deleted (der...
[3 replies] Last: There would be a memory leak if the constructor didn't fail because yo... (by Peter87)
by cooka
validation and menu call
 
case 1 : { char OTX; cout<<"Enter the code reserved for staff and faculty :"<<endl; cin>>OTX; char answer; if (answer != 'OTX' && answer != 'otx' ) { c...
[2 replies] Last: yes I fixed it already but thx for ur time but actually I have anothe... (by cooka)
storing string array
 
I need help with this stupid code. void getnames(string names , int numStd) { for (int i = 0; i < numStd; i++) { cout << "Enter the name of the studen...
[3 replies] Last: Mixing >> and getline often lead to problems like that. The easiest wa... (by Peter87)
by Kalcor
This just won't work
 
First of all, here is the question: The game has (m + 1) players and n types of soldiers in total. Players «Call of Soldiers 3» are numbered form 1 to (m...
[3 replies] Last: A B C D E berserks x x x swordmen x x x pikemen ... (by keskiverto)
Employee Data Base using Data structures
 
Hello, I am still fairly new to programming and currently I'm taking a class revolved around data structures using c++. I've been working on a project but have ...
[2 replies] Last: GunnerFunner, I have since progressed further and instead used class E... (by LordeGreg)
Return value for recursive program
 
Hi, I am writing a recursive program to return two indices of a vector whose values add up to a target value. I want to pack two such indices in a vector and re...
[no replies]
by Kalcor
Understanding this
 
Hello, can someone explain this little problem to me ? a bit of illustration would be great ^^ Toastman came up with a very easy task. He gives it to Appl...
[3 replies] Last: Adjacent means ONLY right next to. NOT anything in the same row. NOT a... (by Moschops)
Some Wrongs Occurred When Sending Data to Serial Port
 
Hi, When the 90C51(this one: http://www.kynix.com/Detail/1155503/90C51-G267.html ) serial port sends data to serial debugging assistant,there are some wrongs oc...
[1 reply] : its been a while but the 4 settings that matter on a serial port are t... (by jonnin)
std::map error: cant apply < to struct
 
hi, i want to generate a new type (struct) A. it has only 1 member variable: map< X, list<Y> > mappedvalues; X and Y are simple struct which can be default co...
[2 replies] Last: finally i solved it. first i overloaded operator <, but that lead to d... (by John87Connor)
Error with unordered map
 
Hello so i have this error while using unordered maps: no known conversion for argument 1 from 'std::string {aka std::basic_string<char>}' to 'const key_type& {...
[6 replies] Last: Since your program runs at coliru it's probably complier specific? N... (by mbozzi)
What does the const in this function mean in UML?
 
length() const : int I get that int is the return type here but what is the keyword const after the function? What does it even mean?
[2 replies] Last: http://stackoverflow.com/questions/3926929/const-function-specificatio... (by closed account 48T7M4Gy)
I need help with my c++ program
 
He he hdc c
[1 reply] : don't double-post: http://www.cplusplus.com/forum/beginner/215473/#msg... (by gunnerfunner)
by Kalcor
EPS?
 
I see this #define EPS 1e-9 alot and Idk what EPS is? I searched it up but nothing useful related to this constant
[2 replies] Last: it stands for the greek math symbol epsilon which is being used in thi... (by jonnin)
by Nei
Embedded C++, memory management and containers
 
Hi, I've been searching the internet for this for a while, but I could not find anything that fits my needs. So Here's my question : does anybody knows abou...
[2 replies] Last: +1 for allocators, that's what I used back when I worked in embedded f... (by Cubbi)
Need to fix my minimum function
 
Hello is a formality on all the post maybe putting it should help get replies. I have a function that outputs the minimum number of a certain function kind of h...
[2 replies] Last: You are the best. Thank you so much. =) (by Joeyisepic8)
by Alex A
How to break out of a for loop ?
 
Guys,is there a better way to get out of the function procedure when months==0, without using the break. I try using a bool value on the for loop but it does no...
[2 replies] Last: c++ has an excellent goto statement and breaking out of nested loops u... (by jonnin)
Simplest if construction solution ?
 
HI, there is a thing what i need : ////////////////////////////////////////////////////////// if (expression1 > 3 && expression2 >4){expression3 = 5;} ///...
[2 replies] Last: I don't see a way around testing both conditions anded to the common e... (by jonnin)
by slixxz
DFA at run time
 
I am currently working on a program that will take a English description of a language and then use the description to create a DFA for those specs. I allow cer...
[1 reply] : My question is how would i know how many states I will need? since th... (by lastchance)
May 2017 Pages: 1... 7891011... 14
  Archived months: [apr2017] [jun2017]

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