Beginners - April 2019 (Page 21)

by medosz
Class member function
 
I have no idea how to write the statement for the displayAccount member function. I have tried everything. I would be grateful if someone could correct it for m...
[1 reply] : void displayAccount (){ std::cout << "\naccount1 name:" << ... (by Repeater)
by TJW
Linear search doesn't work
 
I tried to compare the comparison times between the linear and binary search. However, the linear search didn't locate the value at all, and kept asking the use...
[3 replies] Last: Oh, yes you're correct, I missed that part of it while reading that. O... (by Ganado)
Big number arithmetic
 
I've been looking on this code a lot and I even rewrote it and I still can't find what's wrong.It has to print the factorial of an entry n. #include <bi...
[5 replies] Last: If you want to use big numbers you can create a class BigNumber where... (by dhayden)
Template programming
 
Hello, if we have the following function template<typename T> void mySwap(T& a, T& b) { T temp = a; a = b; b = temp; } What requireme...
[3 replies] Last: Rule of three/five/zero discusses the operator= https://en.cppreferenc... (by keskiverto)
2d array
 
I am trying to initialize a 2 dimensional bool array to false with a constructor. I have a print function that is to display an '*' for each element of the arra...
[4 replies] Last: Show the definition of the class. We cannot see how you declare the b... (by keskiverto)
methods get and set
 
Hello I have four files: AllOnesGA.cpp, GeneticAlgorithm.h, Population.h, Individual.h And I don't know why individual.getFitness() give me -1 and not 2 that is...
[13 replies] Last: Sounds about right. Java tends to pass by reference, by default. C++ b... (by Repeater)
Can't figure out why I'm getting this error
 
I was given code I was supposed to run for class but I get this error every time. Undefined symbols for architecture x86_64: "Date::Date(int, int, int)", refe...
[1 reply] : You declared a constructor Date(int,int,int) on line 13 in Date.h: ... (by lastchance)
by TJW
Selection sort doesn't count correctly
 
I tried to compare the bubble and selection sort, so I set the counters to count the times each sort iterated to find the value. But the results seemed incorrec...
[6 replies] Last: #include <iostream> // return the position of the smallest item at o... (by JLBorges)
Input file opens but nothing is saved. Help!
 
Hello out there! I am having trouble inputting a text file into my code. The text file I want to use looks like this: A 1 5 B 2 5 C 4 5 D 20...
[3 replies] Last: Thank you both for recognizing one of my problems. I switched my if s... (by Marcos8701)
Random number calculations Read from/Writing to a file
 
For context here is what I'm supposed to do... Write a program that generates a list of random numbers of type int and output to a file named randoms.txt. Then...
[5 replies] Last: Yea I figured it out thank you for your help! (by Deadweight77)
Making a display menu and asking user to choose one and error check to keep asking until one of the three are chosen
 
Im trying to make it where you choose either 1,2, or 3 and if you don't choose one of those then it will repeat and ask you to try again basically. Im unsure i...
[1 reply] : Getting and validating user input is an example of a loop where the ex... (by dhayden)
C++ Console Program - Determining highest and lowest score for diving competition.
 
I am currently writing a small program in VS17 for my c++ class. I'm sure you all have heard this 'diving' question multiple times before and are probably annoy...
[1 reply] : You could make two variables high and low for example and every time ... (by Zivojin)
Correctly identify items of 2D vector for comparison
 
I request the input of a number from the user. My code is supposed to query the info in ContainerQ to find the correct vector row items that is also equal to th...
[3 replies] Last: Hi...just a fyi...I have cleaned up my file. My query and document fi... (by sunshine4)
Set Precision command when converting float value into string
 
Ok, I am trying to make a string of values inputted by users. Since the values might include decimal values, so I am forced to use float variables. however,...
[1 reply] : to_string() does not have any way to set precision. For a float or a d... (by AbstractionAnon)
Erasing array element
 
I need help. Could yall explain what's happening in the code where I left question marks in the comment place ? This is my first time erasing elements. Done thi...
[3 replies] Last: you can do it, but you probably have a bug. I don't see it. print th... (by jonnin)
no overwriting object
 
Hello I have four files: AllOnesGA.cpp, GeneticAlgorithm.h, Population.h, Individual.h And I don't know why individual.getFitness() give me -1 and not 2 that i...
[1 reply] : Duplicated post: http://www.cplusplus.com/forum/beginner/251854/ (by Enoizat)
Reversing an array
 
EDIT : I managed to find if the array is symmetrical. However, I'd like to have one text to output if the whole array is symmetrical not numbers. An example I h...
[10 replies] Last: #include <iostream> #include <vector> #include <algorithm> #include <... (by lastchance)
Problems with Dialog windows!!
 
So what im trying to do is make a dialog window that opens more dialogs by using buttons, the main window is fully operable and all, but the windows that i open...
[no replies]
by medosz
Constructor + member function
 
I am trying to write a program with 5 data members constructor initalize the first 3 data members. A displayCarDetails member function should display all the da...
[1 reply] : The problem is that this code does not compile, for many many reasons.... (by Repeater)
Small Problem with a getline statement
 
I seem to be having a problem on a snippet of code in my program. In this portion of the program I am looking to display the numbers of vowels from an entere...
[3 replies] Last: I think you'll find this works: #include <iostream> #include <strin... (by Cheddar99)
April 2019 Pages: 1... 192021222324
  Archived months: [mar2019] [may2019]

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