General C++ Programming - September 2016 (Page 15)

function multiple thread static
 
int& fun() { static int i{ 100 }; return i; } if multiple thread call fun simultaneously, 'i' will be initialized more than one time?
[2 replies] Last: thanks! (by Wu zhen hai)
Variables not working in conditional statements?
 
int main() { int example = 0; int condition; cout << "Type your choice.\n"; cin >> condition; cout << endl; if (condition = 1) { ...
[4 replies] Last: -= will subtract whatever it is that is on the right hand side, so ... (by JayhawkZombie)
How to store bitset in a vector, or convert it to int?
 
I have code that converts a string into binary, but I want to be able to store that binary code in a vector, but of course I can only store ints in a vector. Ho...
[no replies]
Help Counting Printed Numbers
 
Hey everyone, I need some help with this homework assignment. I have to write a program that prints all of the prime numbers from 2 to 100,000 and prints the nu...
[1 reply] : int totalPrimes=0; When you determine a number is prime totalPrim... (by SamuelAdams)
Writing to file causing weird characters to appear at end.
 
I'm trying to write a string to an empty file. The string is succesfully written, but what confuses me is why the program adds hundreds of weird characters to t...
[1 reply] : Don't ever reuse a fstream object when it has already completed its j... (by jlb)
i don't have idea who write this, anyone can a help me
 
You should do a program from a character array allocated with new simulate the behavior of the operating system when the above functions are invoked. To this mu...
[no replies]
need help with inline assembly
 
Hello guys I hope you can help me on this one! Im having an issue when I want to push callm1 char callm1 ={'1','7','4','7','F','1','F','2','8','B','C', ...
[1 reply] : Push the elements one by one: _asm { lea esi,callm1 mov e... (by skaa)
isspace & isdigit explict call
 
The below program deletes all whitespace from the string array. I was having problems with the isspace function. After googling my issue i came up with 2 soluti...
[no replies]
Opening .txt file
 
here is the code i wrote i am not sure whats wrong but the contxs.txt file its not opening. The code the just skips to end from the part where i am trying to r...
[6 replies] Last: turns out i placed the file in wrong folder. Thanks guys!!! (by adbharad)
Difficult exercise
 
Hey guys! Could you give me some tips on this reddit 3 easy challenge. Welcome to cipher day! write a program that can encrypt texts with an alphabetical c...
[9 replies] Last: glad I could help (by shadder)
How is this possible
 
<; Exported entry 1. posRegisterApplicationWithPackage ; Exported entry 2. posUnregisterApplication ; Exported entry 3. posInstantiateObject ; Exported...
[no replies]
by AceK
Can you compile a 64-bit app with MingW?
 
Hi guys, This may sound stupid but I am curious, can one compile a 64-bit app with a MingW 32-bit compiler. I've been told that MingW doesn't support the com...
[1 reply] : Mingw-w64 http://mingw-w64.org/doku.php Two MinGW builds based on Min... (by JLBorges)
by Dkob1
Main
 
class State { public: State (string stateName); // initialize with the given state’s information int getPopulation(); // return the state’s populatio...
[1 reply] : To compile your main function, you just need what you have above; it... (by MikeyBoy)
HW HELP PLEASE!
 
I am stuck on this assignment. Any help is greatly appreciated. Thanks in advance ////////////////////////////////////////////////////////////////////// cla...
[2 replies] Last: The teacher neglects to mention the copy assignment operator. A modern... (by keskiverto)
(Homework Problem) Text based adventure game using While loop, but don't completely understand why it's not working.
 
So I have been working on my intro to programming assignment and got to this problem where we must create an adventure game with three options all text-based. T...
[10 replies] Last: I would use integers instead of 'a','b','c'..... Because you can find ... (by shadder)
by Nyapp
ifstream gives unexpected output
 
So here's the class I'm having trouble with (I'm mainly talking about the loadlevel and access functions, but i've included the whole class just in case): cla...
[5 replies] Last: You can do what ocreus suggested with std::istreams: uint32_t i; str... (by helios)
by bozmin
Problem to execute
 
hey every body. I keep getting this error message when I compile my code: UserClass.cpp:78:32: error: unexpected type name 'string': expected expression ...
[7 replies] Last: UserClass.cpp lines 8-10: You have declared two constructors and a de... (by AbstractionAnon)
by O26rus
Please explain what this function does?
 
int function(int n) { static int i, j; for(i = 0, j = 0; i < 13; i++) { j += (n>>i)&1; } return j; } . . . int i=0; fo...
[3 replies] Last: Technically, just the number of bits with value=1 in the least signifi... (by doug4)
by Roson
how do i display numbers in graphics mode?
 
I'm currently making a program where i need to show the scores at the top right screen. But the thing is I'm using graphics and I cannot use outttextxy(x,y,numb...
[4 replies] Last: With itoa it's quite simple: int num = 32; char buffer = {0}; itoa(... (by Thomas1965)
unwanted numbers in object member
 
In this code I pass object 'monster' as parameter through function 'connect _frags': connect_frags(monster). There it calls a function 'printMonsterName' which ...
[3 replies] Last: Adding the type to function helped. Removing the 'cout' to cout<<monst... (by technologist)
September 2016 Pages: 1... 1314151617... 19
  Archived months: [aug2016] [oct2016]

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