Beginners - August 2019

Inserting node at the beginning in linked list
 
Hye, everyone! Is this the right way to add a node in the beginning? The code is running fine! Thanks #include <iostream> using namespace std; struct abc {...
[2 replies] Last: Is this the right way to add a node in the beginning? No. When head==N... (by dhayden)
Class prototype
 
how do you make the prototype of a class? I’m pretty sure I’ve seen it before but I’m not sure how it looks, the reason is I have two classes that have ea...
[2 replies] Last: What’s a adjacency list? How is that challenging to do correctly? W... (by highwayman)
Input Validation with integers
 
I'm a beginner in C++ and I'm currently practicing. I am trying to write a code that accepts only a five digit integer user input. For instance, the user inputs...
[2 replies] Last: You need to state your actual problem (and show some code). A suggest... (by lastchance)
Thinking to Get C++ Certification Exam Practice Questions with Answers
 
I am thinking be be C++ certified, is there any place I can get exam practice questions with answers?
[2 replies] Last: Personally, I'd be skeptical of a C++ certification. If I were hiring,... (by dhayden)
complexity of build heap in heap sort
 
I'm trying to count running time of build heap in heap sort algorithm BUILD-HEAP(A) heapsize := size(A); for i := floor(heapsize/2) downto ...
[9 replies] Last: on phone, bard to type... Accidental typo, or deliberate. Either wa... (by George P)
Problem with getline()
 
I have a problem with this C++ code: ifile has been opened successfully. ... std::string str; ... ifile.ignore() ; // This appears to be necessary std::getli...
[3 replies] Last: Hello GerryWolff, I have revised your code a bit. The comments should... (by Handy Andy)
Swapping two random numbers
 
Hi everyone, I'm new to C++ programming language. This post is a continuation of my previous post (http://www.cplusplus.com/forum/beginner/257709/). Looking a...
[9 replies] Last: Thank you Jonnin for your suggestion and explanations. I will study... (by sarah1993)
file not being read in
 
I made some of the recommended edits and it still isn't changing those errors. I think it has something to do with my readem function i dont think it's reading...
[2 replies] Last: Make crn, credithours, and numstu initialized with zero in the struct.... (by poteto)
sum of the GCD of all the subarrays
 
what is the most efficient way to find the sum of gcds of all the subarray without using tabular DP(as the memory constraints doesn't allow to form 2D array)
[12 replies] Last: [quote=notacoder]Can you write the code implementation of the above ex... (by dutch)
Problem with #include <ifstream>
 
I have the following lines in my program: #include <fstream> #include <ifstream> #include <ofstream> After ‘building’, Visual Studio says abou...
[7 replies] Last: compared with other versions may be "very very old". I was talking ab... (by jonnin)
by f4rr3l
help me plz im noob
 
Hi guys i have a homework of c++ and i cant it, anyone can help me, i just need choose 2 exercises of 3. , anyone help me with the c´++ codes plz 1.Implemen...
[2 replies] Last: 1 is fairly easy. A portion of what you need may look like this: strin... (by jonnin)
C2146 Syntax error
 
I have the following lines in my program: #include <fstream> ... extern void LANG1_main(); extern ifstream ifile; extern ofstream ofile; After b...
[2 replies] Last: Thanks for this. By a bit more digging, I'd arrived at much the same c... (by GerryWolff)
Iterators
 
I have to rewrite some code using iterators. The code will reorganize names and scores into descending order. I have gotten a start on it but am feeling lost. ...
[12 replies] Last: Thank you guys for the help! (by stoneJax)
What Do I Put?
 
Hello. I'm a bit new to C++, so forgive me if it's a bit choppy. I am trying to make a program that takes 10 integers, and COUTs the sum of the negative numbers...
[5 replies] Last: Hello GamaByteLuke, I was working on the following code before I see ... (by Handy Andy)
Why the move constructor is not used?
 
#include <iostream> struct X { int * data; X() : data(new int ) {std::cout<<"default_constructor\n";} ~X() { delete data; std::cou...
[12 replies] Last: Whoops, I typed without really thinking about the details of what I wa... (by Albatross)
Nested function calls?
 
We have a program to do where you have to find the largest and smallest number in 5 values. I was able to make the smallest work using what our teacher calls "n...
[7 replies] Last: For future reference, you can deal with lists of things by splitting o... (by Duthomhas)
struct nested in a union nested in a struct
 
I'm reading about the OVERLAPPED struct: https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-overlapped I know that a struct is es...
[11 replies] Last: I wish c++ had embraced the de-facto union access. Its prettier than... (by Niccolo)
by djfr33
Needing help I am new to this.
 
Here is the problem I am working with.....If there are 18 people in your class and you want to divide the class into programming teams of 3 members, you can co...
[5 replies] Last: [quote=djfr33]Jonnin it is supposed to be working off of doubles. Th... (by lastchance)
Are parameters by reference automatically "dereferenced"?
 
I had never thought of this before, but I noticed that the & operator behaves differently when used as an "address of" operator and as a reference parameter. E...
[3 replies] Last: I suspect that they just ran out of symbols to use. Everything you can... (by Duthomhas)
by Bopaki
Help as to why am I getting this error message
 
I am starting with linked lists. I get these errors when compiling this program: Compiler: Default compiler Executing g++.exe... g++.exe "C:\Dev-Cpp\buildLi...
[4 replies] Last: Lines 18 to 20 should look like this void *list::buildListForward() ... (by salem c)
August 2019 Pages: 123... 8
  Archived months: [jul2019] [sep2019]

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