Beginners - July 2020 (Page 3)

Reference variables not working
 
I have an issue, my teacher assigned me to use reference variables, but the program doesn't work ( its about sorting 3 strings entered by user ), and I tried re...
[7 replies] Last: Well said @nikovch. I think there were more than 3 suggestions actual... (by againtry)
Array
 
Make only one change to the program below so that the current output changes to the desired output. Desired output: Monday onday nday day ay y #include <i...
[5 replies] Last: No, weekDays is an individual character. But I guess you got your an... (by Ganado)
by bld
Why do you have to download Java, but not C++
 
I'm trying to understand how programming languages work. I still don't get why do you need to download certain languages, like Java, Python, Go etc. But this do...
[10 replies] Last: but I don't have to download the language itself, right? As I have ... (by TheToaster)
Is it possible to create a getter for a private array?
 
I currently have a private bool array, in class A that I would like to use in class B. Class B has access to has a list of class A, and for each object of Type ...
[9 replies] Last: #include <iostream> class A { private: bool links {false, true, ... (by againtry)
by totoo
trouble using cout within recursive iter
 
hello, im probably overthinking this, but im having trouble printing out the count of comparison that happens in quick_sort and merge_sort as well as properly ...
[1 reply] : You must initialize count to zero. Then have both functions return th... (by dhayden)
returning an array from a function?
 
I have an exercise that seems to be worded poorly, would like some opinions: "Write a function that finds the first occurrence of a value in a two-dimensiona...
[2 replies] Last: The sad thing here is that the assignment is teaching you to be a bad ... (by dhayden)
binary tree questions (1,2)
 
Hello everyone - have a question about traversing a binary tree to insert a node correctly. Struggling at the mo :( This is what Have so far #ifndef ...
[22 replies] Last: Yeah it’s too long to post all in one ☹️ (by jamesfarrow)
printing ansi art in windows cmd?
 
Hello, do any one know how to print out ansi art in cmd with the help of c++? I have learned that cleaning screen is system ("CLS"); If you copy the cod...
[2 replies] Last: https://docs.microsoft.com/en-us/windows/console/console-virtual-termi... (by jonnin)
Where have I specified a return type for a constructor?
 
Hello, I have 2 classes, one parent and a derived one. I receive the error where i get the following " return type may not be specified on a construct...
[3 replies] Last: Hello Shishykish, It is the little things that cause the biggest prob... (by Handy Andy)
Functions: Prime number
 
How do I print the following output? Q: tests all the numbers from 2 to 10 (inclusive) and prints out the results, each on a separate line. (Hint: Use a for...
[1 reply] : I would probably approach it like this int n = 20 for (int i = 2; i... (by Shishykish)
stop reading input with cin when reach a delimiter
 
Hello, Is their a function for cin to stop reading input when reaching a delimiter. I have to read a line with multiple fields. (int), (8 character max ch...
[7 replies] Last: Ah i see, okay thanks. (by noahpereira20)
(int i = 0; i < strlen(char*); i++) throwing warning?
 
I'm getting a Visual Studio Warning for the following statement m_plate std::cin >> m_plate; for (int i = 0; i < strlen(m_plate); i++){ .....
[2 replies] Last: perfect thanks. (by noahpereira20)
do while doesnt work like expected
 
Hello, i have 2 input-types int. They have to be bigger than the ones before. Start values is 0 and -1; Allowed Values: { 31,32,41,42,43,51,52,53,54,61,62,63,6...
[4 replies] Last: #include <iostream> #include <algorithm> struct Pair { // or just us... (by Ganado)
Private & public function problem
 
Hello I'm learning cpp and I'm currently fiddeling with private and public functions. I think I have missed something in my code. Thanks for any advice ERROR ...
[2 replies] Last: @Repeater, Ah my fault I forgot. Now I understand. I'm learning. Thank... (by blackshore)
by totoo
memory leak + copy constructor & assignment for Queue
 
I ran valgrind on my homework, and there's a memory leak somewhere. I think it's in my constructor. Also, how would I start with copy constructor and assignm...
[3 replies] Last: If you don't want to bother with std::, just declare using namespace ... (by mbozzi)
by totoo
random number inside vector
 
hello how do i insert randomized elements inside a vector without repeating elements? i came about this article that I thought would help me but i think I'm im...
[6 replies] Last: totoo, please also read this thread: http://www.cplusplus.com/forum/be... (by Ganado)
Disappearing struct in pointer
 
I am fairly new to C++ and have been coding Java for over 4 years. The memory management of C++ is new to me and I want to make sure I understand it correctly. ...
[9 replies] Last: Sorry, I had more than Object2 that needed to be allocated with new. (by johnglen244)
Move Zero's Problem - Understanding syntax choices and logic
 
Hi all, I found a working and efficient solution to a problem but without an explanation, and I'm trying to make sense of it. I understand the problem, but I'm ...
[3 replies] Last: An efficient solution to this problem is provided in the standard libr... (by mbozzi)
by SO AP
Whats the difference between using "?" and if statements
 
So as per the title i'm having time trying to find the difference between using "?" and if statements. Is one considered proper format or does one have potentia...
[3 replies] Last: A ternary expression is generally more difficult to read than the equi... (by helios)
Help with exercise
 
Hello, I am working on some exercises in c++,and i am stuck on this one. Could someone help me? Thenk you The aim of this exercise is to check the presence ...
[5 replies] Last: #include <iostream> using namespace std; bool exists(int , int, int... (by Manga)
July 2020 Pages: 12345... 12
  Archived months: [jun2020] [aug2020]

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