Beginners - March 2020 (Page 8)

by LoMoyi
Using C++, how to randomly generate either one, two or three digits.
 
Using C++, how to randomly generate either one, two or three digits. -----------------------updated 2020/3/17------------------------------- Thanks so much for ...
[5 replies] Last: "I need X digits" is a vague statement. It can be integer digits or d... (by George P)
Need help with calling average from function
 
thanks
[3 replies] Last: You have to pass information between the functions. double calc_aver... (by keskiverto)
Worker Threads: What?
 
Basically I was too lazy to include the <chrono> header, but I have to wait for some time. The thing is I don’t know how long to wait, so I just made a “bus...
[17 replies] Last: Actually this is the finished product. Lol. #include <mutex> #inclu... (by highwayman)
Double a Stack
 
I have a function push()that adds entries to a stack. I am trying to double the size of the stack when ever it becomes full. I can't put the function through de...
[7 replies] Last: Thank you for your help. I appreciate it! (by stoneJax)
std::remove but specify max elements to remove?
 
std::remove will 'remove' every matching element in a container, how can I specify that it removes up to a max number of matching elements?
[3 replies] Last: #include <iostream> #include <vector> #include <algorithm> using name... (by lastchance)
lock vs try_lock
 
I think I’ve messed up my understanding of try lock and lock in mutexes. Does lock wait until it can lock, or does it just immediately lock without checking...
[2 replies] Last: Awesome ok, thank you! :) (by highwayman)
by Bopaki
The function "removeElement" is not doing it's job
 
Here is what I get in the output: Value #1: 15 ". 2: 10 ". 3: 5 " 4: 3 Item to be deleted is not in the list. Value #1: 15 ". 2: 10 ...
[3 replies] Last: You can greatly simplify the remove function. Instead of keeping a poi... (by dhayden)
move objects to unordered_map without creating copies
 
Hi experts, I'm a beginner of C++. I have some questions while trying to insert some objects to an unordered_map. I have a struct called "test", like bel...
[1 reply] : map.emplace(1, std::move(t1)) (by mbozzi)
updateAccount() member function has no output
 
I need to turn a struct into a class. The class needs to display bank account details - first cheque account and then an updated member function to update the d...
[3 replies] Last: The output only shows me the information in int main You never cal... (by TheIdeasMan)
Reading numbers from a file
 
Hi, I'm trying to read some numbers from a file called numbers.txt. There are 10 numbers in this file in this kind of format: numbers.txt 87 89 91 93 95 97 9...
[3 replies] Last: [quote=bobcat854]I was just wondering what exactly was the logical err... (by lastchance)
linked list
 
im trying to create a overloaded assignment operator of a linked list with this struct struct item { string name; double price; int sold; int stock; ...
[4 replies] Last: im trying to create a overloaded assignment operator of a linked list... (by Enoizat)
Linked list delete item
 
Hi, I finally have some time, thanks to COVID-19, to go back and cement sections into my brain. This was an old project of mine where I had points taken off fo...
[3 replies] Last: Oh, of course. It's obvious once pointed out. Thanks fellas. (by jjordan33)
Calculate average and use multiple int
 
I want to create a new project in C++, but i have a little problem. My project is about university admission, and for every student i need this informations: n...
[7 replies] Last: main.cpp compiles when it's this: #include <iostream> #include "Stude... (by dhayden)
by larryl
Template Class Member Confusion
 
Hello Folks: I don't use templates very often. I'm doing something stupid. Visual Studio doesn't like my list's const_iterator type declaration. The follo...
[4 replies] Last: Thanks again coder777: I need to get up to find some time to learn ne... (by larryl)
String Literals
 
Are string literals put on the stack? Dose that mean that they automatically - uh - disappear like regular ints and stuff? Is this safe void fnc(){ char* x...
[2 replies] Last: that you've attempted to cast away. XD ya know that about sums up t... (by highwayman)
Well guys I'm stuck
 
the error I'm receiving is error: 'class PacketProcessor' has no member named 'SetSeqStart'| any ideas? processor.SetSeqStart(eid_low);
[2 replies] Last: Hello itachix, The question is which file is this line of code giving... (by Handy Andy)
by BP138
A little lost on how a program/classes should be structured.
 
I'm making a small game with SFML just as a learning project. I'm doing decent so far but one thing I feel like I'm not doing "properly" is where I'm putting ...
[2 replies] Last: When the bullet is in the player's clip or gun, the clip or gun owns i... (by dhayden)
code error help
 
I'm getting this error when trying to compile does anyone know a solution? 420|error: cannot convert 'std::ifstream {aka std::basic_ifstream<char>}' to 'bo...
[2 replies] Last: Thank you for helping it worked (by itachix)
by mpg
Some exercise about complexity
 
Excuse can you tell me about these exercises that I have done, are they all correct? Many thanks!! i=2; // +1 j=0; ...
[7 replies] Last: I no longer have an opinion of right or wrong. I am just letting you ... (by jonnin)
Wanting help with sockets for a project
 
So I'm trying to make a function that creates a socket, and then uses a switch statement in order to decide what it sends out to the server and how to handle wh...
[15 replies] Last: well I now have a kinda slimed down function for using the Networking ... (by VaasKahnGrim)
March 2020 Pages: 1... 678910... 14
  Archived months: [feb2020] [apr2020]

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