Beginners - October 2020 (Page 2)

by syeare
Vector Not Printing
 
What I must do: Make a program that makes a double vector with at least 30 negative and positive elements. I also must have functions to calculate/print th...
[10 replies] Last: Hello syeare, constexpt started with the C++ 2011 standards. It is ... (by Handy Andy)
Equip Item (attach one class-instance to another)
 
Hi there I am currently working on my first mildly complex test-program. It is a RPG-Combat program where I want to test some programming techniques to later...
[7 replies] Last: Well, I'm really fairly new to programming. So while of course my goal... (by theoneandonlyboiler)
by josh84
C++ patterns
 
Any help on how to get this pattern printed? ********** ********* ******** ******* ****** ***** **** *** ** ...
[3 replies] Last: Thanks guys. This is the code I ended with. It works well... #inc... (by josh84)
Calc standard deviation
 
I need to calculate the mean and standard deviation of 16 house prices. The data is being read in from a text file. The program compiles, but it does not correc...
[3 replies] Last: You are never using the return value of your calcMean function. The me... (by Ganado)
by jelani
Why can't I type std::cout in std::cout?
 
I'm trying to make a translator of sorts that asks you what Python keyword you want to find the C++ equivalent of. std::cout << "The equivalent of 'print(...
[3 replies] Last: Thanks! I changed the line of code. It turns out that there was anothe... (by jelani)
Monty Hall Calculations
 
So I'm having a bit of an issue when I'm trying to calculate the probability of each strategy in the Monty Hall problem. I'm trying to print out each game won, ...
[9 replies] Last: coder777, THANK YOU. I was looking in the wrong place. (by ChesterPlus)
Reading file into 2D array, separated by comma
 
Hi, so my assignment is to create a French to English translator. My first task is to take a file and put the 1000 English and French words into a 2D array. The...
[7 replies] Last: string langArray ; Unfortunately, this is not standard C++ - al... (by seeplus)
How can I demangle names without running c++filt
 
if I run this like ./prog I get: St13runtime_error too few arguments if I run this like: ./prog | c++filt -t I get: std::runtime_error too few argum...
[5 replies] Last: @Ganado Thank you very much -- it is exactly what I was looking for. (by closed account oivD8vqX)
by jnxmm
How can I change a character inside a string?
 
Hello! How can I change a character inside a string? For example, cout<<"sin(a): "<<sin(a); The "a" in sin(a) needs to be changed into the number inputted...
[2 replies] Last: Thank you so much! (by jnxmm)
Add error checking to this program
 
I have the following two programs in which I want someone with the knowledge to help me check and add some lines CODE #1 code to see did it catch the first e...
[3 replies] Last: You don't need to use an array/vector. You can read a line from each a... (by seeplus)
by ngb123
* or & ?
 
Hi, my most confusing part of programming in c++ is the decission of using * or & in a functions argument-type when passing data pointers. I have read tha...
[2 replies] Last: In pass-by-value, a clone is made and passed into the function. ... (by againtry)
What did I do wrong?
 
what did I do wrong? everything worked fine but my else { cout << "no, it is not divisible by 9" << endl; is being ignored and I can't get it on output...
[2 replies] Last: Thank you, I'm still new to coding and I did change some stuff you hav... (by rainpiggy21)
by syeare
Array Parameter Changed Into Vector Parameter (Passed by Reference)
 
Hello, I am trying to convert a double array parameter into a vector. I don't have a very full understanding of vectors and I couldn't comprehend the document...
[1 reply] : Vectors keep track of their size, so you don't need to pass that separ... (by dutch)
time and wrong input message
 
hi, the question says to get the current time and display a message if the input is incorrect. i got the time but how do i get a message? im a beginner who kn...
[11 replies] Last: fidarova, forget your initial attempt at using time_t or localtime, et... (by Ganado)
Exception code: 0xc0000409
 
So I wrote a beginner's program to wipe out some files and copy some updated ones in their place. I used ALOT of system( ) commands and decided now it was time...
[14 replies] Last: Another weird thing I noticed is that if I let everything sit for seve... (by Vendetto)
using get line to enter a strings into a dynamic array
 
Hi, I'm in my second semester of c++ and am having trouble entering a string into a dynamic array. Here is my function: [code in main] int size; /...
[5 replies] Last: Good idea to check and an alternative while loop arrangement: #inclu... (by againtry)
Base class pointer accessing derived class method
 
I am writing a Bank Account management system and have an abstract base called AccountsFactory. I use a static method AccountsFactory::create(int option) which...
[2 replies] Last: Thank you. There is so much to remember about inheritance and polym... (by mickydint)
ofstream open?
 
Hi, I am learning about the streams and files etc. And I am on the ofstream open, and my book says that the prototype for the open for the ofstream is v...
[4 replies] Last: This part of the prototype is a 'default value' ios::openmode mode = ... (by mickydint)
Convert an array, so that odd numbers are in the first half, even numbers on the second half.
 
Example: Input: 8 1 2 3 4 5 6 7 8 Output: 1 3 5 7 2 4 6 8 It is necessary to use pointers I know my code is not correct, how can I make it right? ...
[4 replies] Last: if you use a vector you can use the Standard Template Library partitio... (by mickydint)
"clock" object
 
with std::chrono, how could I make a "clock" object that keeps system time?
[12 replies] Last: Try this. It's adapted from cppreference and can be run in a separate ... (by againtry)
October 2020 Pages: 1234... 13
  Archived months: [sep2020] [nov2020]

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