Beginners - July 2018 (Page 5)

Inserting element at the end of a linked list.
 
Well,The function InsertAtTheEnd(); is not working as expected. My logic is sound and implementation also pretty accurate,I know i must've done some silly mis...
[3 replies] Last: Remember to check that temp5 is not null before entering the loop! (by helios)
How to code grid perimeters
 
Hi, I'm new to c++. How can I create a simple grid map using a 2D array, in C++? Like below illustration as an EXAMPLE: # # # # # # 5 # 1 # ...
[2 replies] Last: #include <iostream> #include <string> #include <vector> #include <ran... (by icy1)
Inserting element at nth position in Linked List
 
The function InsertAtnthPosition() is not executing properly at the program crashes. I have yet to add deallocation statements. What is the error in that functi...
[7 replies] Last: Actually I've been always indexing linked lists from 1 since i started... (by akshatmahajan3112)
follow up: console closing down, code example (1,2)
 
I wanted to follow up about the console closing, and one of the solutions. Is there any way I could get some help debugging my code, and turning...
[28 replies] Last: This looks like crap because it is looping through so fast. But press ... (by Manga)
bit operations
 
Hi - can anyone explain to me why these are not equivical? Or at least they are not on my iMac... Thanks in advance James #include <iostream> #include <bit...
[3 replies] Last: Strange example, since 16387 << 2 comes out to 65548, and typical rang... (by icy1)
Checking if a key exists in an unordered_map and incrementing its value
 
I'm trying to check if an unordered_map contains a particular key, and if this is true, then increment the key's associated value by 1. However, I seem to be ha...
[6 replies] Last: too few mentions of '43' in the output from other answers, or actually... (by icy1)
Arrays with incrementing values...yay! :(
 
So the code is supposed to be basically like a survey. And it would be soooo easy if we could write our own code how we wanted... but our teacher wants it his w...
[5 replies] Last: @BGA6444 -- when did the teacher code stop and yours begin? It's not ... (by icy1)
by t009
Ctrl+Z causing double entry in while(cin)
 
Using ctrl+z to exit a while loop causes the loop to record the last value twice into my vector. Any idea why? while(cin) { cin>>input vector.pushback(input)...
[2 replies] Last: One quirk of C++ is that a stream doesn't register end-of-file until a... (by dhayden)
int / float
 
Greetings, short question: a = static_cast<float>(150-i*i)/10.0f a is a float, i is an int. Why is static_cast necessary? I divide integers b...
[2 replies] Last: Thank you jlb, I am not using anything, it's from a book :) (by PhysicsIsFun)
Trying to understand how to access objects members from functions
 
Hi all, my first post here! So, I'm pretty new to c++ and still getting to grips with some of the basics. I've been trying to read as much stuff before askin...
[2 replies] Last: Ah ha! I can't believe it was that simple! Thanks very much :) (by Hollowman)
Destructors
 
I'm having a hard time understanding the application of destructors to a class. My book only gives one example and it's not the best and the examples online I ...
[3 replies] Last: Ahhhh ok thank you both for the responses that definitely clears it up... (by passiontrip)
Unable to access options
 
Hi, I'm new to c++ and really need your help to program as stated by topic. I can't seem to get my main menu switch case to work. Whenever I select '1', its ...
[2 replies] Last: You had the correct idea for a menu, you were simply missing a few ite... (by closed account E0p9LyTq)
Segment Fault.
 
So i`m trying to finish up a program i`ve been working on but I have hit a wall with a segment fault. It runs perfectly for a little bit but than as you go alon...
[4 replies] Last: I have hit a wall with a segment fault Lucky you! I can’t even com... (by Enoizat)
looking to learn from breaking the rules
 
"C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off."-Bjarne Stroustrup. What does "blowing w...
[2 replies] Last: > I want to know besides things like infinite loops, any "ill advised"... (by JLBorges)
Changing to arrays
 
// I need to change this to arrays but can not figure it out #include <iostream> using namespace std; // Function Prototypes void getJudgeDa...
[6 replies] Last: #include <iostream> #include <algorithm> #include <iterator> constex... (by JLBorges)
while(1) & Interrupts
 
Hello everyone, I am using PIC micro controller to program a series of leds. My question: is it possible to break out of while(1) loop in the animation with an...
[4 replies] Last: I need to clear g_status bit, but not sure how to do it. g_status... (by Repeater)
by b3y0nd
2D - Array - User input - Nested For Loops
 
I am calling a function getsales - asking for the elements to fulfill a 2D array using FOR loops. I was getting errors compiling for quarter and column count...
[9 replies] Last: Hello b3y0nd, For this subject you are welcome. I am glad it worked o... (by Handy Andy)
problem passing 2-D vector to a function (1,2)
 
why am i getting runtime error ,i spent a lot of time learning taking user input in 2-d vector ,still i am failing to do that. Somebody,please help #include<b...
[24 replies] Last: thanks a lot ...can you help me with debugging on code blocks...i ca... (by MikeyBoy)
by b3y0nd
Saving / opening / saving arrays
 
Is this the best way to go about saving / opening / saving an array. had the first program because the file pathway to storing a file was a problem, seems so...
[2 replies] Last: You could also write on a binary file. I think it would be less tediou... (by H00G0)
by Donut
Bubble Sort
 
I am attempting to sort some salary data that I import using bubble sort. However, I am not getting the sorted data out to the screen. What am I missing? ...
[9 replies] Last: Thanks again for your help and guidance. As I stated previously I am m... (by Donut)
July 2018 Pages: 1... 34567... 17
  Archived months: [jun2018] [aug2018]

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