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

iostream/cin.fail question
 
Hi, below, followed by a question: #include <iostream> int main() { //signed short x; unsigned short x; std::cin>>x; if (std::cin.fail...
[8 replies] Last: You mean mine causes undefined behavior? Yes. Neither I noticed so... (by cire)
by Gyiove
Neural network, trying to implement adadelta from caffe.
 
Hello everyone! I have done alot reading about deep learning and it just happenst to be that the more I read, the more confused I get cause I'm having hard ...
[2 replies] Last: I decided to download the whole html and upload it cause it seems hard... (by Gyiove)
by JFWong
Length of string
 
int main(){ char *Statement = "Hello! How are you today? I am well, thankyou."; cout << sizeof(Statement) << endl; int j = 0; while( j < sizeof( Stateme...
[2 replies] Last: You use std::strlen() or std::char_traits<char>::length() to deter... (by Duthomhas)
Exe to open password protected exe
 
Hi! I wonder if it's possible to code .exe file that can open another, but password protected .exe file. Basically, I wrote application that is encrypted ...
[1 reply] : Greetings, Well, if you look at it the idea is simple : + Create a e... (by Naughty Albatross)
by elay
class private function for one task
 
is it only okay for a class to have many member function to finish a single task? i do it to separate codes, but i will only call those private function once b...
[1 reply] : How many times you call a function is irrelevant. Use a private functi... (by Peter87)
Little question about std::forward (reference collapsing)
 
Let's have a function called Y that overloads: void Y(int& lvalue) { cout << "lvalue!" << endl; } void Y(int&& rvalue) { cout << "rvalue!" << endl; } Now...
[2 replies] Last: Hi Cubbi, really thanks for the reply. This argument has been discuss... (by gedamial)
thread and lock
 
#include <iostream> #include <thread> #include <mutex> #include <chrono> int main() { std::mutex m; std::thread t1([&]() { while (true) { ...
[8 replies] Last: thanks! (by Wu zhen hai)
header files creation undefined reference
 
I just started creating header files of my project but i quiet am not getting it right i use code blocks 16.0 currently i am stuck with " undefined reference " ...
[8 replies] Last: closed account 5a8Ym39o6 and coder777 thank you for your suggest... (by swap1155)
Getting tuple value via variable
 
I'm trying to get a tuple's element via an integer variable. The problem is when I run this code I get 14 errors: Error C2784 'const tuple_element<_Idx,std::pa...
[3 replies] Last: I don't think what you're trying to do is possible, think about it, yo... (by a k n)
Parameter Pack expansion - how to understand them correctly?
 
Hi. I've been struggling for weeks about how Parameter Pack extension really works. Preface: I over-used Google and cppreference, but I still don't get it. ...
[9 replies] Last: Hey, I came up with this some seconds ago template<class... T> doub... (by gedamial)
Passing a derived class object (that is stored in a vector) into a function.
 
Hello! I am recreating the classic Asteroids game from my childhood, and have run into a problem. Because of the frame rate, bullets pass through asteroids b...
[2 replies] Last: Yes, here is the code for both: std::vector<Bullet> bullets; st... (by MirrorSpock)
by helios
std::condition_variable
 
I have an issue with std::condition_variable that I can't seem to get through. So, the typical usage pattern for condition variables is std::unique_lock<std:...
[4 replies] Last: Oooh. I had seen several examples where the mutex was not locked at al... (by helios)
by dr86
Reason for declaration of enumerator in OpenFOAM
 
Hello. I want to implement something new in OpenFOAM, but I have trouble to understanding existing code. Problem starts at line 161, file KinematicPar...
[2 replies] Last: All right. I wanted to give more information, so I have posted in this... (by dr86)
by Roson
What is "Cannot have a type qualifier"?
 
I have a Class called m_c. When i compile the program, it says : identifier 'm_c' cannot have a type qualifier. What does this mean? thanx in advance!!
[1 reply] : You've got a const somewhere it doesn't belong. (by Duthomhas)
Delaying class member initialization
 
Lately I've been working on an OpenGL project as a hobby. This project contains a Window class that wraps all window callbacks used by the GLFW library, which I...
[1 reply] : maybe you can define a constructor for Camera that accepts a glfwWindo... (by fcantoro)
by Roson
game - lasers as separate variables
 
hello world, im currently creating a game where you have a spaceship (movable) and has to shoot asteroids in its path. (Something similar to galaga, i guess)...
[4 replies] Last: @necip...... im currently working with turbo c++, not codeblocks..... ... (by Roson)
Help with this for loop
 
In the 1st loop the arguments (nCount, nCount & 3). What does the & 3 do or mean? Storage8<bool> cBoolStorage; for(int nCount = 0; nCount < 10; nCount...
[1 reply] : > What does the nCount & 3 do or mean? It is a bitwise operation. htt... (by Naughty Albatross)
by Monke
Need help with script!
 
Hey! I'm trying to learn c++ and tried to create a combat simulator. This is the script: #include<iostream> #include<string> #include <random> #include<ctime>...
[9 replies] Last: If you want the results to differ more why don't you use it : std::... (by Naughty Albatross)
by elay
enum problem
 
in my header file i have this code: class Menu { Menu(); enum page { defaultPage, page1, page2, page3, NONEPAGE }; page menuPage; } int my so...
[3 replies] Last: @AbstractionAnon i thought i wrote menuPage lol thanks guys :) (by elay)
individual pixel control
 
I am remaking a projects I did in 2000 reproducing steven wolfram's cellular automata. I had some success back in 2000. I used to acces each pixel via something...
[5 replies] Last: You can always load the image data yourself, but you need some kind of... (by Duthomhas)
July 2016 Pages: 1... 8910111213
  Archived months: [jun2016] [aug2016]

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