Beginners - April 2021 (Page 11)

by PK Dey
inline function
 
The following code gives same result whether "inline" present Or not. Then what is the purpose of "i...
[6 replies] Last: inline is just a suggestion to the compiler. [quote=cppreference]The... (by deleted account xyzzy)
by hbcpp
Prevent computer from sleeping in Linux
 
I need a way to prevent the computer from sleeping, turn it on/off at runtime. I believe SetThrea...
[11 replies] Last: @jonnin You can read here https://docs.microsoft.com/en-us/windows/wi... (by hbcpp)
Provide a proper variable
 
how should I right a variable in int gindex (unsigned int PC, int bank, long long hist, folded_hist...
[4 replies] Last: typically a pointer is initialized to one of 3 things: nullptr keyword... (by jonnin)
by akeilo
Needing help with my loop
 
I was wondering how I could fix this loop to keep asking the user to input a number after the wrong ...
[3 replies] Last: Hello akeilo, Here is something to think about: #include <iostream>... (by Handy Andy)
by hbyte
My Easter Algo - Scrappy Genetic Algo
 
(S)crappy Genetic Algorithm! Visualise solving Styblinski–Tang function This is the Scrappy GA ...
[no replies]
by ericM
pass template object to function
 
I am using several histogram objects (from boos::histogram). I would like to pass these histograms t...
[3 replies] Last: As a simple curiosity, how do I make sure that T implements the requ... (by mbozzi)
2d matrix problem
 
Array (a) consists of 5 rows and 5 columns. int a [ ][ ] ={{2,-5},{3,6,1,-4,2},{8},{9,2,1,2,9},{4,...
[6 replies] Last: Hello samzavax, Like I said first show me how you would print the arr... (by Handy Andy)
Whats wrong with my code?
 
Whats wrong with my code? #include <iostream> using namespace std; int main() { int x,y; ...
[10 replies] Last: Hello Pepeforever, I think it is time to go back to the beginning and... (by Handy Andy)
by NiceS
File getting deleted instead of appending
 
Im trying to create a function that checkout a tool for a user when called, currently my entire chec...
[7 replies] Last: outFile.open("tools.txt"); This will delete the tools.txt file da... (by seeplus)
Trying to assing a value of a static member of a struct
 
So i have a simple struct with only a single static varialbe as shown below: struct X{ stati...
[4 replies] Last: @seeplus thanks man you are a life saver (by Kallinteris Andreas)
Unable to print user input in quotes
 
Hello so I'm writing a program that converts decimal to binary format but can't seem to print the us...
[1 reply] : cout << '\"'; before and after the for loop, not inside it.... (by Ganado)
loop problem
 
I have a project for programming course, I wanted to make a program where I use loop (while, do whil...
[2 replies] Last: thank you for your help! I put the code and run it but in the end of t... (by samzavax)
Address of function will always return true
 
Hello, I am new to this forum and C++. I am testing a function that will do something if another fun...
[7 replies] Last: Thank you so much. Using the c was a better approach and it worked. Th... (by patCplusplus)
by PK Dey
t1, t2, t3 undefined
 
when i run the following code it is showing that t1, t2, t3 are undefined! But think they are object...
[2 replies] Last: Because time is a standard c function. - which is probably being inclu... (by seeplus)
Unknow error
 
I have this code below implement a simple Virtual Machine to load instruction and do things to data....
[9 replies] Last: There is a place in your code where you most likely are doing: throw ... (by Ganado)
I need to figure out how to declare variables but my professor is not explaining correctly and can barely understand her
 
#include <iostream> #include <ctime> #include <cstdlib> #include <algorithm> using namespace s...
[4 replies] Last: how to declare variables See tutorial: http://www.cplusplus.com/doc/... (by keskiverto)
Ternary Operator in this function
 
Hello, I was searching for a solution to a challenge and this was one of the answers, but I can't un...
[3 replies] Last: It's not good code though - as arr is passed by value not by const ref... (by seeplus)
How can I increment elements of a vector(or array)?
 
Adding to this 'example' would be appreciated : int x = 1; std::vector<int> children{}; int dog...
[12 replies] Last: @seeplus, yes that was the point, I really did not understand how I co... (by possum swallower)
Printing private class array data
 
I want to get data from an objects array and print it using "cout". Having trouble figuring out how ...
[3 replies] Last: > Why is your Student object called a 'classRosterArray'. That doesn't... (by ne555)
Unrecognized syntax in sample code
 
I did a bunch of C++ programming back in the 1980s and early 90s, but not much since. In trying to p...
[2 replies] Last: Thanks! Yes, I'm old enough to have read "Goto considered harmful", so... (by Steve Frysinger)
April 2021 Pages: 1... 9101112
  Archived months: [mar2021] [may2021]

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