Beginners - December 2019 (Page 7)

For Loop does only runs once
 
I am trying to fill out an array by reading data from a txt file. The txt file is in the format: food name 1.99 ...
[3 replies] Last: thank you salem you have solved this for me. I had already tried cin.... (by ppzz123922)
by medosz
loop with while statement
 
I am trying to write a simple money exchange program. The following should happen: User enters maximum five currency-exchange rate pairs. Then gives the amount ...
[8 replies] Last: Something of little to no concern for someone learning to code. My p... (by MikeyBoy)
by Acania
Base 10 to base 16
 
Hello so I have this problem/homework for uni and it's due today and I am completely stuck. It says: Write a program which transforms from base 10 to base 16 ...
[4 replies] Last: #include <iostream> #include <string> using namespace std; string to... (by lastchance)
reading and putting numbers in an array
 
the code executes normally until it reaches the part where its supposed to find the big and small numbers then it just stops but the functions seem fine to me c...
[3 replies] Last: 👍:) (by highwayman)
read/write problem with 2d arrays
 
when i run the readEm and WritEm for state and action they both come back very wrong, i can't fit the whole driver program in here but the problem should be in ...
[5 replies] Last: Andy Notice my pm (by mr55)
by hbcpp
Is it possible??
 
Hello I was wondering if it possible to create custom functions like for, for_each, while etc. For example if one wants to create another version of the f...
[17 replies] Last: @dhayden Great example, just looking at that code I can feel the pain ... (by hbcpp)
function understanding
 
what is better in a program "writing and executing" while using the function is to declare the function before main and write the definition after main? or writ...
[3 replies] Last: Ganado peter87 Thanks a lot best regards. semsemdiver... (by semsemdiver)
Why doesn't the variable change as expected?
 
Ok so I'll admit i haven't been programming for a very while and I was trying to familiarize myself with how things work. So here goes. class sampl...
[3 replies] Last: operator+= generally should return a reference to the object changed. (by Ganado)
How can I limit the value of a variable?
 
In the following code j is supposed to take the values {0,3,6,1,4,7,2,5,8} sequentially for n=3. But (j%(n*n-1) part makes it 0 when it should be 8. Any way to ...
[2 replies] Last: @keskiverto Thanks. That seems to work. (by Rakib771)
creating multiple objects and storing them in a list (1,2)
 
Let's say in a class called 'coordinates', I store two variables x and y. Is there a way I can make another variable in another class of 'coordinate' type so I ...
[22 replies] Last: @Repeater, thank you so much! That cleared everything up now. (by rts17893)
by noyou
How do I write a file write loop?
 
Hello I am trying to write a loop that lets me add an employee number with the data that the code gets from the user to a file. And then it runs the code again...
[2 replies] Last: Thank you, I will try this tonight. (by noyou)
HELP! How to make slot machine columns rotate separately
 
Hi guys, I'm building a slot machine console program, and I need to make the columns stop rotating one by one. I have manage to make the whole array visually 'r...
[4 replies] Last: Duplicate post: http://www.cplusplus.com/forum/beginner/266187/ (by deleted account xyzzy)
HELP! How to make slot machine columns rotate separately
 
Hi guys, I'm quite new to C++, but I'm building a slot machine console program, and I need to make the columns stop rotating one by one. I have manage to make t...
[1 reply] : Duplicate post: http://www.cplusplus.com/forum/beginner/266140/ (by deleted account xyzzy)
by larryl
NULL iterator?
 
I'm not a beginner, but I have this beginner question: When I'm using pointers I can initialize them to NULL. I can then perform operations that may, or...
[9 replies] Last: I'm still interested in totorials to help move from C++ 98 to C++ 17 ... (by deleted account xyzzy)
by momof4
how do I make possibilities true or false?
 
So, I know that number values are all true except 0, that's what keeps coming up when I try to find answers elsewhere. I'm making a sudoku program, and I'm maki...
[7 replies] Last: take a chance to learn something new. set would do it, add 1-9 to a s... (by jonnin)
vector in an abstract class
 
Let's say I create a vector inside an abstract class. How would I be able to use .pushback() from another class if I can't initialise an object of an abstract c...
[6 replies] Last: It's meaningless to try and push back a number to an object of type c... (by MikeyBoy)
Genetic Algorithm
 
Hello I'm writing a genetic algorithm code to create a string. I run the code and it gets pretty close to my target, but then says the fitness is 1 when it is o...
[1 reply] : Found the error: Before 'largest' should be evaluated, there should b... (by nuderobmonkey)
Swap Struct in C++
 
Hello, I want to swap elements of an array but I have an error. Why? Severity Code Description Project File Line Suppression State Error C2676 binary '[': 'St...
[4 replies] Last: I was not saying to make the data dynamic (that would indeed cause cac... (by jonnin)
read/write/swap problem for array of strings
 
so i have a list of reserved words i have to read in from an input file sort and then write to an output file. nothing except the title is being written. any ...
[1 reply] : sortEmRes(...) is wrong. It should be: void sortEmRes(int a, string re... (by coder777)
infinite loop in read of a .bas for lexical scanner
 
i'm building a lexical scanner. for some reason when it gets to the read of my .bas it starts an infinite loop and i can't see why. any help would be apprecia...
[1 reply] : Hello TheJast I have several questions: 1_ Have you initialised your... (by H00G0)
December 2019 Pages: 1... 56789... 13
  Archived months: [nov2019] [jan2020]

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