Beginners - August 2009 (Page 11)

how to compute time complexity
 
Hello everyone! Can someone help me out how to compute the time complexity of this codes: #include <stdio.h> void main() { int i; for...
[6 replies] Last: Further to johnkravetzki's mention of the clock() function; here's an ... (by chrisname)
Namespaces
 
There seem to be different views on using 'using'. Some say use ' using namespace std ', other say don't but rather prefix std functions with ' std:: ' whils...
[3 replies] Last: I agree with Bazzy. using std::string , for example, is something I u... (by chrisname)
ambiguous overload resolution
 
I have a class that converts a set of 4 numbers to one number or a set of 5 numbers to a number. It is used to go from one to the other. I call the one numb...
[1 reply] : It's all those default parameters values. Any function call where les... (by guestgulkan)
Using a passed reference
 
Probably a simply problem but I just don't get it. // define structure typedef struct { int day; int month; int year; } Date; //function def...
[2 replies] Last: SOLVED i changed the dateFunction to: void dateFunction (Date *... (by ajeannotte)
.txt file data erasing error
 
Hello, attempted a computer science degree at one time, then figured it wasnt for me, and now I want to be a paramedic. Anywho, I somehow got thru the first 2 c...
[4 replies] Last: I made some updates, it looks like this now... #include<iostream> ... (by uncleernie666)
File I/O: Extracting Buffer Contents
 
Hi, I hope you can help me with my problem. I got this code from http://www.cplusplus.com/reference/c.../cstdio/fread/. Now after the file contents have been lo...
[2 replies] Last: Thank you very much! This code worked perfectly! (by qtdenise)
Source code from my book not working
 
Here is the source code, it's supposed to be a card dealer program. #include <iostream> #include <stdlib.h> #include <time.h> #include <math.h> using n...
[2 replies] Last: The compiler is pretty straight forward about what the problems are. ... (by Tevsky)
grade arrays
 
I am trying to create a code that will give me a table a number of students (i.e. using ID in the fist column and numbering the students) and putting in grades ...
[1 reply] : A simple for would be fine: for ( int i = 0; i < array_size; i++ )... (by Bazzy)
by ryyst
Memory management question
 
Hi all, I've coded a bit in C++ these days and always wondered about memory management. So far, I've never consciously paid attention to memory management, a...
[1 reply] : You don't have to delete objects allocated with automatic or static me... (by Bazzy)
Adding a header file?
 
So I have a file called main.cpp and another called Character.h, in the same folder in a DevC++ project: //main.cpp int main() { return 0; } //Ch...
[4 replies] Last: Whenever you declare a class, you can also declare objects of that cla... (by NGen)
Separating exception classes from interface
 
Hi, I'm creating exception classes for one of my class (say, Foo), and would like to separate (not only the implementation but also) the declaration from the ...
[5 replies] Last: afaik, you can do this: class Foo { public: class xBarOne; ... (by Disch)
Effective use of iterators?
 
So I'm just starting to learn about iterators in the book I'm reading. One of the exercises of the chapter is to go back to the last chaper and recreate a prog...
[7 replies] Last: Thank you all, I think I have a clearer idea of how to do this now. :) (by closed account Ly59GNh0)
by ripper
Integer array to BMP
 
The topic : http://www.cplusplus.com/forum/beginner/4307/ is no longer accessible.. so.. stating my question here.. I have an Integer array stored in.. x ...
[9 replies] Last: Hey.. Thanks a lot.. Will Try it .. (by ripper)
Clarification on Unions
 
I was looking for a bit of guidance on when to use unions. The way that I've understood it from reading my book is that you should just use unions to store vari...
[9 replies] Last: @Disch: Yes, in the general case that is definitely true. Given ... (by jsmith)
printing prime numbers error
 
i'm trying to print prime numbers between 1 and 100 but all that comes out is 2 and a very large negative number. can you guys please point out any errors in my...
[4 replies] Last: neither x nor n is initialized in main() before you use them... by ... (by masquechique)
Need some ideas on how to program the pawn piece in chess
 
Hey guys: I'm working on a chess program for comsci, and surprisingly, the pawn is the hardest piece to program. If you're not familiar with chess, this i...
[10 replies] Last: Since Pawn is derived from Piece, I'd suggest a hasMoved flag in Piece... (by jsmith)
by NGen
Allocation of Booleans?
 
How much memory is allocated for a single boolean value? Just a bit? Do they allocate a whole byte to keep a consistent pattern? Or does it vary across compiler...
[12 replies] Last: Well with boost::any you can do things like: boost::any a( 4 ); ... (by jsmith)
.Net FrameWork?
 
What is the .net frame work, and what does it do? Please give a simple explanation. Thanks!
[9 replies] Last: The following may be of interest: A Critical Overview of C++/CLI, Pa... (by closed account z05DSL3A)
line.find_first_of() not finding required text
 
Hello all, Thanks in advance for your attention & time. The code below is meant to put the first column of an input file into array gene1 and the second ...
[2 replies] Last: Hi Kempofighter, Thanks for your pointers. I left out the 0 param... (by jem8271)
by fredy
Simple question yet so hard 4 me
 
Guys, I wrote these following statements in my program but the output is not as i expect.The compiler DID NOT ask any input for the * line.Why? char a,...
[2 replies] Last: may I suggest you to use cin and cout from the iostream library instea... (by Drake Aran)
August 2009 Pages: 1... 910111213... 17
  Archived months: [jul2009] [sep2009]

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