General C++ Programming - June 2016 (Page 10)

Simple logical code vs logical simplicity
 
This is a simple code if(a==b) return true; else return false; I found out that this can also be written as return a==b; Although the second one is on...
[9 replies] Last: Consider the first example in the tutorial on functions: int addition... (by Chervil)
by pxcpp
VS2015 update 2 bug?
 
#include <iostream> struct ChangeMemoryStructure { int x = 5; }; struct Base { int id = 1; }; struct Derived : public ChangeMemoryStructu...
[6 replies] Last: OK I've reported it (by pxcpp)
Strictest Rules Possible Flags
 
I am using the GNU Mingw 5.3.0 g++.exe for my compiler. I am trying to make my c++ library as reliable as possible by trying to compile it with the most stricte...
[5 replies] Last: Hi, Here are some that are still not enabled when using -std=c++14 -... (by TheIdeasMan)
Verify a certain number of command line arguments without using if statement
 
I would like to verify a certain number of command line arguments are given, but without using an if statement or similar. I want to change something like thi...
[3 replies] Last: You are wasting time. First, go and profile your program and show tha... (by Duthomhas)
Delete object in priority queue
 
Hi everyone, I have a priority queue containing pointers of rectangle, void g_markCells(int qID) { int ID = 0; priority_queue< gridRecord*, vect...
[no replies]
How to convert a UNICODE string to ANSI
 
Hi, I have wchar_t wszMessage ; and need to return char const* Can somebody point me to the ways I can convert from wide strings above to nor...
[3 replies] Last: Thanks! Juan (by JUAN DENT)
by Vabi
not able to understand code
 
here is the code I am unable to understand, const int size=2; int main() { item *p=new item ; item *d=p; } can anyone please explain what is trying to do wi...
[2 replies] Last: item* p points to the first element of the new array created on the ... (by gedamial)
call _invalid_parameter_noinfo
 
Is there some way to prevent std::vector generating the subject calls? Crawling around in the headers, it looks like they are (may be?) produced conditionall...
[1 reply] : Turns out that setting #define _SECURE_SCL 0 #define _HAS_ITERATOR_D... (by BrowserUk)
Changing loops to call generic functions
 
I am working with this code: #include <string> #include <iostream> #include <sstream> #include "minimax.h" #include <algorithm> #include <iterator>...
[7 replies] Last: The command line arguments in argv are null-terminated multibyte s... (by JLBorges)
Access a private data member within output opearator
 
I am working with this implementation file: #include "section.h" #include <list> #include <iomanip> using namespace std; Section::Section () : theCallNumb...
[13 replies] Last: cire gave you the answer here: http://www.cplusplus.com/forum/gener... (by cire)
by PacR
Access address of class objects inside std::List.
 
#include <iostream> #include <list> using namespace std; list<void*> playerlist; class player { protected: void* id; public: player (...
[3 replies] Last: Thank you AbstractionAnon. (by PacR)
Funky tic-tac-toe
 
So, i have this game of tic tac toe: #include <stdio.h> #include <stdlib.h> #define flag 10 //esta funcao recebe uma matriz e a imprime na forma tabu...
[1 reply] : PLEASE USE CODE TAGS (the <> formatting button) when posting code. It... (by chicofeo)
Assignament operator for a queue not working properly
 
I've been playing around with dynamic allocation and queue recently. Keep in mind that I am fairly new to data structures and I’ve been teaching myself by wat...
[2 replies] Last: well, I seem to have fixed my problem. (by redempvfx)
Why is my boolean function not working
 
Hi, Been stuck on this program for a long while now and can't get the boolean function to work, it keeps on returning false when it is true. #include <iostr...
[3 replies] Last: With or conditions, there is short circuiting: as soon as one of the c... (by TheIdeasMan)
by Gyiove
loop variable inside the loop question
 
Hello everyone, for(int i = 0) { for( int j = 0 ) { } } int i, j; for(i = 0) { for( j = 0 ) { } } 1. Should I be worried about d...
[3 replies] Last: Basic types can be allocated on the stack in zero time, so these two s... (by helios)
Boolean function not working
 
Hi, Anyone could spare the time to look at my program and see why the boolean goes straight to boolGood, can't fix it #include <iostream> using namesp...
[2 replies] Last: Thanks been stuck on it for ages (by gibbsy619)
Dental Records
 
Hi guys! I have this project at school that I need to make a program which is "Dental Records" I don't know how to make it cause i'm new in programming. It woul...
[2 replies] Last: Develop your programming skills first, your teacher should give you so... (by gibbsy619)
Showing the buttons pressed in a GUI Application
 
Hello there, i have a program with 5 buttons: Abyssal Scepter -> Writes something into ChampionName-SummonersRift.txt Aegis of the Legion -> Same thing, differe...
[1 reply] : You have to catch the WM_XXXX Messages: http://stackoverflow.com/ques... (by closed account 48bpfSEw)
Study guide
 
To mods: I am posting a friend's code online so that we can all study the material together on one website. Please do not delete! I appreciate it greatly. ...
[18 replies] Last: Even if they weren't aware of better alternatives, it's still an obvio... (by helios)
by homing
struct definition / declaration - style question
 
hey guys, I'm just curious how you guys would define & declare a struct which is only used by one class and others don't need to know about it. Right now i li...
[8 replies] Last: If the structure is a necessary part of the interface to the class, th... (by MikeyBoy)
June 2016 Pages: 1... 89101112... 14
  Archived months: [may2016] [jul2016]

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