Beginners - June 2013 (Page 41)

Recursion and counting/incrementing
 
Hey I'm practicing with recursion. I'm trying to write a function that will count all the nodes in a binary tree. given the following class definition. ...
[9 replies] Last: I can see whats going on but piecing the actual logic together is anot... (by Ramzi89)
int *myPointer = 0 (What's the point of this pointer?)
 
What's the point?
[1 reply] : It's a way to initialize a pointer so that it doesn't contain junk (an... (by xish)
Moore's Voting Algorithm
 
Hey guys I need help understanding how this code works for finding a majority element in an array. I understand the first main function, and also the bool funct...
[no replies]
Abstract classes & Pure virtual functions
 
Hi there. Im still a bit confused by abstract classes. I get the concept but am just a bit confused by the implementation. In the below note the addition of ...
[6 replies] Last: Constructors cannot be virtual. Wouldn't hurt to try this stuff in a ... (by cire)
Possibly Data Type Problem
 
Beginner programmer here. This is Problem 3 on Project Euler. The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the ...
[5 replies] Last: My second code is the correct program. Its output is 6857. I guess I'... (by zeitgaver)
by epi975
Strange char duplication
 
Hello! I am currently having a strange issue where the '@' char is duplicated when being sent to cout. Heres the code: #include <iostream> #include <win...
[3 replies] Last: Wow thanks! It worked! It's amazing how such little things can have su... (by epi975)
Baseball Stats program compiles with errors
 
Hello all, I am a noob in the process of learning C++ and so far things are going good. However I wrote a pretty simple Baseball statistics program from out of ...
[9 replies] Last: Okay well, I probably just need to finish reading this chapter I am in... (by dredwerx)
by musipc
Random generator
 
Hy I have a problem with my school project. I need a program to generate random numbers, in predefined colums and rows. The problem is that the program only gen...
[1 reply] : Try solving it using two-dimensional arrays. It will be easier(or at l... (by MatthewRock)
Euler Project Problem #3 (1,2)
 
Hello! I've been trying to solve problem number 3 of the "Euler Project", which basically is to find the largest prime factor of 600851475143, but my code does ...
[23 replies] Last: but my program still has major flaws. if for example the user inputs... (by MatthewRock)
invalid types 'char[int]' for array subscript
 
Hello all, So I was continuing my little text based adventure game, and I ran into a pinch. The code has gotten too big to post here, so here's the link to ...
[5 replies] Last: Firstly this comparison is incorrect from the logical point of view. I... (by vlad from moscow)
by Zoo
Vector input
 
Hi! I would like to input 10 numbers to my vector. I am having a bit of tough luck though. Would someone direct me into the right direction? My code: in...
[4 replies] Last: >>L B Got it thanks! (by Zoo)
Is one variable in nested loop alright?
 
for(unsigned short int i = 1; i <= 10; i++) { for(unsigned short int i = 1; i <= 10; i++) { cout << 0; } cout << endl; } Fir...
[2 replies] Last: According to the C++ Standard A name introduced by a declaration in ... (by vlad from moscow)
Using "cout" in an "int" function
 
Quick Intro: The problem will probably be obvious, but I just started programming a week ago. I'm exploring different uses for functions, and wanted to create o...
[3 replies] Last: Personally, your example works too, but if you plan on NOT cout'ing th... (by S G H)
by mahta
Invalid Allocation Size
 
I get the error- Invalid Allocation Size - for this part of my code: int var; float *res; cin>>var; res=new float[var+1]; Why is it like that and...
[6 replies] Last: Thank you very much! (by mahta)
Why not make all functions inline?
 
....... if a function calls make the statements of the program jump and that jump makes the program slower compare to straight execution of statements from top ...
[3 replies] Last: Thanks :D (by jasonrobertz357)
Getting input without cin ?
 
Is there a similar command that does not pause for the user to enter information? For example if I wanted to break a loop when a user presses the 'x' key, how w...
[4 replies] Last: Thank you coder777 and Andy, solved my problem! (by DrZoidberg)
Mushymon
 
Right now I have two completed projects, and the first one works perfectly, but is there a way to justify why a string with value 0 converted to an array become...
[14 replies] Last: Here is the C# equivalent program for the C++ code above shown by me. ... (by vlad from moscow)
C++ string problem
 
Why I cant enter any input into the train.place1.from structure? when i compile no error occur. struct date { int day; int month; int year; }; ...
[1 reply] : Line 36 leaves a newline in the input buffer, so your getline() reads ... (by Zhuge)
Variable increment issue
 
Ok, weird issue here. I have the following variables set in this exact order: b8 cnrIsModeGood = false; u32 cnrGoodModel = 0; u32 cnrBadModel = 0; u32 cnrMax...
[9 replies] Last: Earlier you showed the typedef typedef unsigned int u32; but in yo... (by shacktar)
auto Keyword
 
Hello! I'm just going to ask you guys a simple question, I was reading about the "auto" keyword, but when I tried it out it did not seem to work, and I don't re...
[2 replies] Last: It works now! Thanks a lot :) (by GoranGaming)
June 2013 Pages: 1... 3940414243... 49
  Archived months: [may2013] [jul2013]

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