General C++ Programming - February 2019 (Page 10)

by Fadey
calling from global class's constructor, is it safe?
 
void triggerMe(int in); class second; class first { public: int something; first() { something = rand() % 50; cout << "first:" << something << endl; t...
[4 replies] Last: Your first example, works, but only because csecond contains purely PO... (by dhayden)
Create a specific structure of array in C++
 
I want to create a structure in C++ in which some of its elements are arrays (as the following code). I would like to allow the user to declare the number of va...
[5 replies] Last: dynamic does not have to mean that it will change size, it just means ... (by jonnin)
i need to add yes or that will restart the loop or exit
 
After identifying the winner, the system should ask if the user want another game (If the user select YES ‘Y’ then new set of game should be perform otherwi...
[6 replies] Last: switches specifically work on integer cases only. You have to find a ... (by jonnin)
C++ Colors
 
I am making tic tac toe game and i want my char 'X' to be blue and my char 'O' to be green and if 'X' or 'O' win i want that winning combination to be red anyon...
[6 replies] Last: It is working now thank you so much. It has some errors but i fixed th... (by Aleksa03)
by RmmB26
C++ community. i have Tasks and need yor help!!!.
 
i need your help. i try to find where is the mistake or mistakes and how to find solution for this code.can explayn where is the mistake or mistakes please repl...
[2 replies] Last: I'm not 100% sure what the actual desired behaviour for this program i... (by TomBroughton)
Trying to improve the leap year algorithm
 
I am trying to improve the leap year algorithm to tell me when the next leap year is if the year entered was not a leap year. I am still new to c++ and this is ...
[4 replies] Last: #include <iostream> bool IsLeapYear(int y) { return y % 4 == 0 ... (by dutch)
Data file read
 
Hello everyone, I am trying to read from a data file. I have a working code, but i am having difficulty on how i can display rest of the data in the data file. ...
[3 replies] Last: Thank you everyone for being great help! It works now and also fixed t... (by hello321)
Undeclared Identifier Issue
 
.
[1 reply] : The path to a file is merely a string with special formatting. String... (by mbozzi)
by frek
Does a C++ programmer need learning C in 2019
 
Hi all, I know that how powerful both C and C++ are. C++ added some new features to C and evolved throughout this long time up to now that we see something e...
[7 replies] Last: Windows, especially its new ones (7 and 10), are mostly written in C+... (by closed account E0p9LyTq)
by nhnam
The insertion in map STL cause code 0xC0000005
 
Hi.I'm implementing the hash map for my own purpose, and my method for this is using a vector of maps (vector< map<Type,Value> >) and for the reason i have trou...
[16 replies] Last: you can compare 8 bytes or less at a go with a 64 bit int. Should be ... (by jonnin)
by RmmB26
C++ community. i have Tasks and need yor help!!!.
 
please, help me to find, what is the final result and how it works. it's code #include <iostream> using namespace std ; void swapnum(int ∗i , int ∗ j )...
[3 replies] Last: A long time ago (286 era here) I tried a BUNCH of ways to swap (int, d... (by jonnin)
const_cast
 
For the following program: #include <iostream> using namespace std; int main() { const int N = 22; int* pN = const_cast<int*>(&N); *pN = 33;...
[6 replies] Last: let me try to explain what you might be seeing, in beginner terms. ... (by jonnin)
Logging functionality
 
I'm making a logging class that is supposed to help with debugging some programs that I'll eventually write in the future. I was wondering how I would be able ...
[10 replies] Last: I'm really unfamiliar with how one would detect errors from the compi... (by AbstractionAnon)
Evaluating Postfix Expressions with Alphabet Characters
 
Hello, I am writing a program that takes postfix expression strings, such as: AB+CD-* And evaluates them such as: (A=1, B=2, C=3...) The evaluation of A...
[1 reply] : > Is there a better way to do this instead of using an if statement? ... (by JLBorges)
Creating a (custom-language) compiler able to use third-party libraries
 
Hello, I'm trying to make my own compiler and ran into a few issues. I know how to get the lexer and parser to work, but how can my compiler use third-party AP...
[7 replies] Last: Get John Levine's book Linkers and Loaders , ISBN 978-1558604964 It'... (by mbozzi)
by Fadey
difference between switch, default [] operator and if else.
 
(no optimizers) int arr = {0,1,2,3} int m1(int i){ return arr } int m2(int i){ switch(i){ case 0: return 0; case 1: return 1; ... you ...
[4 replies] Last: I heard a rumor that compiler makes other elements happen so it can f... (by jonnin)
by vibhu
Communication between threads in c++
 
Hi I am trying to print repeated pattern using thread only 5 times when number of thread are 5 but my program is not coming out of the thread,and waiting for ...
[8 replies] Last: thankyou very much Konstantin2 it's working now thanks salem ...now i ... (by vibhu)
Reading errors/warnings from the compiler
 
Part of the project I'm working on has me write errors/warnings to a log file. I understand that this is the compiler's job, but the project requires me do this...
[14 replies] Last: Oh I didn't see the code snippet my bad. Makes sense. (by Grime)
problem
 
sfghkl.
[12 replies] Last: In the past 5 minutes I've seen 2 posts titled "Question" and one titl... (by dhayden)
by Fadey
std:time() returns invalid time.
 
It is said that std:time function from <time.h> should return the same time if called same time, no matter what computer and timezone it's configured however ...
[6 replies] Last: What makes you think that time() is returning one timezone or another?... (by dhayden)
February 2019 Pages: 1... 891011
  Archived months: [jan2019] [mar2019]

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