Beginners - February 2019

When are functions needed and where should they live? (1,2)
 
I am looking for some rules, explained in beginner terms, about how to use functions effectively. I know what a function is, and I know that it can be used to i...
[20 replies] Last: size_t is a typedef that results in the largest unsigned type the syst... (by TheIdeasMan)
Memory problems w/ Hangman program
 
Hello! I'm having issues with this piece of code that I translated from C++ to C. The problem is that I'm running a code analysis on visual studio code and it r...
[4 replies] Last: Will give it a try. Thank you! (by TomShoe)
names alphabetical order
 
Hi, I feel a bit lost in this code. I have to complete it according to the direction stated in the comments. I have done some parts but I am not sure if ...
[1 reply] : First, comment out the call to sort() at line 25. This will let you d... (by dhayden)
4 winner lottery
 
How do i modify the following code so that a number isn't repeated more than once? #include<iostream> #include<time.h> #include<stdlib.h> #define MAX...
[3 replies] Last: int used[ MAX_NUM] = {0}; //zero is 'false' for (int i = 0; i<4; i++... (by jonnin)
Using setprecision
 
What is the proper placement of setprecision(2) so that I can set the decimals to always be at 2 points when displaying pennies and dollars. I am using it in a ...
[6 replies] Last: Hello ChimpCoder, Over time I have found that cout << fixed << showp... (by Handy Andy)
Rock paper scissors 2
 
Hi, I am not sure what is wrong with this code and how to fix it. It should stop when comp or user reaches 10 wins. Besides MAXNUMgames I am not sure what ...
[3 replies] Last: variable names! if I see maxgames, I expect to play 10 rounds. if ... (by jonnin)
Creating a program using a vector?
 
Here is what I have to do: Read some text into a vector, storing each word in the input as an element in the vector. Transform each word into uppercase letters...
[3 replies] Last: More input. I took the offending for loop off and it stops on DONE no... (by jonnin)
Find the highest and lowest value of a multidimensional array
 
Hi, I had another questions in regards to a topic I previously posted. I was working on finding the highest and lowest value of a multi-dimensional array which...
[4 replies] Last: Ohhh ok perfect I get what you mean now. I'll make sure to apply this... (by kdrewes)
Operator overloading<< to a class
 
Hey! I want to overload the operator to a class. But it doesn't seem to work. Cool if someone could help. I'll post the relevant code to the question below. S...
[11 replies] Last: Sorry, I couldn't keep myself from playing with your code. I admit it ... (by Enoizat)
Tutorial on how to manipulate a text file using the ASCii value?
 
Hello, I am looking to create a line of code that reads in a text file and then manipulates the ASCII value of the string to unscramble the text found in the fi...
[2 replies] Last: define unscramble. Clearly you want an encryption / decryption progra... (by jonnin)
by Majeek
Exe File Marked As Virus?
 
Sent to a friend to see his reaction, and basically all his anti viruses went off including Windows, why? #include <iostream> #include <thread> #include...
[6 replies] Last: do a deep scan on the .exe file to ensure that some actual virus has n... (by jonnin)
by Eraun
Always goes to error
 
I'm pretty new to c++ and I've been trying to create this rock paper scissors game where you can enter the word for what you chose and play against a computer. ...
[6 replies] Last: Alright, so I put the numbDiff = rando - pNumb after the if then state... (by Eraun)
Creating a function that returns a list of objects of a specified type from another list of objects
 
Hey all. As mentioned in the title, I'm trying to create a function that returns a list of all the objects of the specified type from another list(list as in ve...
[3 replies] Last: Yes; a failed dynamic cast on a pointer yields a nullptr . (by JLBorges)
rock paper scissors
 
Hi, I am writing a program that leads the user to play a rock/paper/scissors game against the computer. The first one reaching 10 wins, has won the game. Th...
[2 replies] Last: I have written MAXNUMGames=10 before and it worked, but it stopped at ... (by closed account 4wpL6Up4)
by yat89
Sum up vector and insert function
 
Hi everyone, I got a task to sum up vectors. But each time the amount of the summation reaches 15, I need to insert the value of 0 and sum up the next number un...
[4 replies] Last: Thanks FurryGuy and lastchance for your suggestions. Most apprecia... (by yat89)
C++ Project path
 
Hi, I'm a beginner in C++. I'm using C++ in Visual Studio 2015 environment. I would like to read a text file in the directory folder of my project C++ without ...
[1 reply] : https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbas... (by salem c)
Can somebody explain this code to me.
 
#include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main(){ srand(time(0)); int year = 365; int people = 0; in...
[2 replies] Last: Well you already added one debug cout statement, so add another cout... (by salem c)
by Rubes
Looping issue
 
I can't figure out this formatting loop. The program finds out if a number is divisible by a certain number and if it is then it outputs the numbers it is divis...
[3 replies] Last: Quick and dirty: #include<iostream> int main() { const int row_c... (by closed account E0p9LyTq)
Proper way to use an external binary library in your project, using cmake
 
I'm experimenting with this C++ library, restbed. https://github.com/corvusoft/restbed Following the readme, I checked it out from github and ran the build c...
[1 reply] : You're using CMake wrong. 1. add_library() doesn't link in an externa... (by helios)
by NKGold
Problem with robot code
 
The problem is that Im trying to get rid of a gap in the output(at bottom) but to do so I need to get rid of the first endl under the case'W' but if I do that t...
[1 reply] : Compile with maximum warnings. $ g++ -Wall -Wextra foo.cpp foo.cpp: ... (by salem c)
February 2019 Pages: 123... 23
  Archived months: [jan2019] [mar2019]

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