Beginners - April 2010

new operator and class-type instance members
 
Hi, I have a simple question about using the new operator on classes with instance members of other class types. If I have a class foo with the following def...
[1 reply] : Your first example is right; your second is a memory leak. And yes,... (by jsmith)
How many years do you need to learn C++? (1,2)
 
Just so I have an estimate, how many years has taken you guys to get a good understanding of C++? If you work and can only devote a couple hours a day to le...
[22 replies] Last: When do you regard "learning C++" as finished? Cause if it's just the ... (by hanst99)
Syntax Errors and Formatting
 
Hi All I need some help with this code. I need to fix some syntax errors and am having trouble. Here is the code i started out with: #include <iostream>...
[2 replies] Last: int main (by Bazzy)
C2659: '=' : function as left operand
 
Hi guys, I'm new to coding, I'm doing a course. What I want to do is add keyboard support to the police car, there's support for the van I'm using as a templat...
[no replies]
Question about function
 
I wrote this program but im actually suppose to write it as a function..But im having a lot of trouble writing it as a function... Can someone please explain ho...
[6 replies] Last: Gee... I do know that feeling. Seriously, though, m4ster r0shi's ... (by Albatross)
fstream issue...
 
#include <iostream> #include <fstream> using namespace std; int main() { fstream myfile; myfile.open ("test.txt"); if (myfile.is_open()) { cou...
[1 reply] : If you want to use the file for output and you want to create the file... (by m4ster r0shi)
by Nelo87
copy a string (with spaces) to char array
 
I'm having trouble copying a string with spaces to a char array. If the string does not contain spaces everything works fine (see below): My input was: "h...
[3 replies] Last: Thank you. I need this because I'm trying to make a program that ev... (by Nelo87)
by jbl09
question about this loop:
 
first loop iterates through data by the day of an input file: outputs to a diff file second loop iterates through the trucks in input file:also outputs answer...
[6 replies] Last: i realize what my mistake was and i appreciate all the input thank y... (by jbl09)
by cyeb
Sum of Digits in an Integer
 
(Before you yell as best as you can through the 'net, yes, I CAN use the "Search" button.) I've found this page: http://www.cplusplus.com/forum/beginner/498...
[4 replies] Last: Thanks, solved! Both great explanations. =) (by cyeb)
new and delete operator
 
how to write a programme by using new and delete operator to display the ouput: How many numbers would you like to type? 5 Enter number: 75 Enter number: 4...
[3 replies] Last: It's interesting that that sample output is identical to one from the ... (by Bazzy)
What am I doing wrong...
 
#include <iostream> #include <cmath> using namespace std; int main() { int length; int width; int depth; int total; total = length * width ...
[1 reply] : You calculate total before you allow the user to enter values for leng... (by m4ster r0shi)
combining two int's
 
Hi, i have a problem with C.I need to combine two int's... example: if the int's are 1 and 5, i need to combine them into 15(fifteen).Help,please.Sorry for the ...
[2 replies] Last: 10x (by solomeros)
Question about for loops
 
Correct the following code to add multiples of 3 between 1 and 100. Will this work? Yes or No. If no, explain why. sum = 0; for (i = 0; i >= 100; i = i+3...
[2 replies] Last: No. It should be something like sum = 0; for (i = 0; i <= 1... (by WahooMan)
cin problem
 
when we use cin>> the(( - ))in the output jump one line down i dont want it.for example i want to cin these by keyboard 1 2 3 4 5 6 4 2 3 what can i...
[2 replies] Last: Double post: http://cplusplus.com/forum/beginner/23092/ (by cnoeval)
by Nikoru
Are there Events in C++?
 
I recently just finished my Alice programming class (If you want to call it programming :/) and in Alice we did event's. How is an even done in C++?
[1 reply] : Alice... Programming... please don't use the two in the same sentence.... (by packetpirate)
Class program
 
Can someone please help with this assignment.. Im having a lot of problem getting it started, not sure if im over thinking it...I left this assignment till the ...
[no replies]
empty() vs Null
 
do I need to say: if (item.empty() || item==NULL){ } or does empty() return true if item is NULL also?
[2 replies] Last: If you are using QString or something like that then there is a diff... (by Duthomhas)
switch statments :switch quantity not an integer
 
need some help im writing a class and the constructor for it is: Token::Token(string passedValue) { value = passedValue; switch (passedValue) { c...
[9 replies] Last: did you get this resolved? if so, can you mark it as solved. (by stavros)
separate a string to separate characters in an aray
 
Hey all! I have a problem that i cant seem to solve. How can i separate a string into separate characters ? I only need to know how to read a separate charac...
[1 reply] : A string is made out of separate characters here is an example st... (by Bazzy)
Vector of Vectors size issues
 
I'm reading in from a file, I have a main vector of class objects that is a vector of vectors 2D in array terminology I guess you'd say. So it has to use a seco...
[no replies]
April 2010 Pages: 123... 35
  Archived months: [mar2010] [may2010]

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