Beginners - May 2010 (Page 15)

by Azimer
rand() function: nested if statement
 
I have a 2 player hangman game for class which outputs to the windows command prompt. I use the random number function to select a word from a file and i want t...
[6 replies] Last: [quote=Azimer]Still displays only the cursor, if i comment out the whi... (by Galik)
Program to determine size of a directory
 
Hello, I need to write a program to control the size of several users' directories. Is there a way to determine it from a C++ program, or should I take another ...
[5 replies] Last: Well, on Linux you would use stat (sys/stat.h) but I'm not sure about ... (by chrisname)
by lewdie
How do you let the line of text end with something other than \n?
 
I am trying to write a function for a console app which will allow the user to enter in text using carriage returns and end the line upon input of a period (.)....
[10 replies] Last: Well it could, in the same way system() could be used to delete system... (by chrisname)
virtual function
 
Hi All, I am new to C++, so my question might be very basic. Assuming I have a function which is declared as virtual in one of the class hierarchy, does i...
[1 reply] : Yes. The additional virtual keywords are not required but it might be... (by moorecm)
free C compiler
 
Hello, Can anyone recommend a free general purpose C++ compiler, and if so, where I can find it. Ideally i would like to work within some kind of development...
[19 replies] Last: It was sarcasm, no reply was necessary. Edit: GCC is used on Mac O... (by closed account z05DSL3A)
C++ noob input question
 
Hi all, I want to read space seperated characters to an array of dynamic size. The thing is, all i see around like get(), getline() is for string and preset ...
[8 replies] Last: Problem solved. Thanks everyone. (by thewonderdude)
C POINTERS
 
Hi, Do i need to free the pb->pchr pointer? #include <stdio.h> #include <stdlib.h> struct mystruct { int a; char *pchr; }; typedef struct m...
[5 replies] Last: There's so many things wrong here, it's hard to know where to start. J... (by helios)
by oman
read fraction like matrix (2-D array) use class
 
i have exercise of 2-D array i want read of two matrix function i have my own way! this is the input 1/2 2/3 3/2 4/5 0/1 2/5 3/1 3/4 1/1 1/1 0/1 0/1 3/2...
[1 reply] : Wouldn't it be better if you made your Fraction class hold one fractio... (by m4ster r0shi)
Bitwise AND usage problem understanding
 
Im reading a c++ beginners book and there is a chapter about & (bitwise AND). It is using this to convert a lowercase character to its uppercase equivalent. I c...
[6 replies] Last: That's true. To set a bit you'll have to use the bitwise OR operator. ... (by m4ster r0shi)
Another Displaying Prime number exercise problem
 
This exercise ask me to make a program that uses boolean function to display all prime number from 1-100. When this is run it just gives all the value for i, is...
[4 replies] Last: The logic looks a little bit wrong. Whatever value this function is co... (by rajroshi)
Function-defined string.
 
Lets say I have a function that isolates the y and has x values, like y = 2x + 1 or y = x^2. I want to make a code that would give me a string of the values li...
[5 replies] Last: I found a math parser here: http://www.yann-ollivier.org/mathlib/mathe... (by Ivanlul)
by Cyroq
Capture mouse click (hook)
 
Hi there, I am a beginner at C++ so I don't really know the syntax yet. However, I have written a piece of code yet which captures all keyboard input (using ...
[8 replies] Last: Hehe, BeerPace. That would be a nice school project! I forgot to tell... (by Cyroq)
Why doesn't this loop work?
 
void check_valid_password() { char string ; bool loop = true; do{ loop = true; cout << "Enter the password you ...
[10 replies] Last: No problem. i find that just looking at more code makes be a better pr... (by amaac)
Proper format for displaying time
 
I'm coding a program to add and subtract time from a user given time. The problem I've run into is that I have the hours and minutes in int form. I need to disp...
[5 replies] Last: @dragonbane You are doing it right. You just need to setw(2) rather th... (by Galik)
by MWH
Converting a floating point number to a string.
 
Basically we can not convert a floating point number into a string as it is in #include<string> string str; float x=0.01; str = x; I want to know...
[2 replies] Last: http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/ (by Duthomhas)
by fafner
segfault when reading binary file
 
I'm trying to get into binary file io. I have written a smiple class consisting of an int and a string. Writing this to a binary file seems to work fine(allthou...
[1 reply] : You probably aren't reading the file structure correctly. If you aren'... (by ragn4rok234)
Implementing Inventory System for RPG
 
I am wondering how to make an inventory system for a text based RPG. Right now I have an abstract Item class with Armour and Weapon derived from it. I tried to ...
[3 replies] Last: Alright, I misread your post. Yea dynamic allocation isn't the key. Th... (by Seraphimsan)
Calling function from inside loop
 
Hi Everyone, For full disclosure this is a homework assignment. I pretty much have it figured out, but have something wrong with the way my loop inside main c...
[6 replies] Last: Hi Albatross, Sweet victory at last! My general logic was on the rig... (by hopileaf)
assigning an instance to null problem
 
okay so I want to check through an array of objects to see if it exists for a certain name supplied, if it exists return the appropiate object and if not i want...
[2 replies] Last: Okay thanks alot for the help (by alMarshy)
by amma
Saving content of classes without files
 
Hello, How can I store the contents off the class structure itself? I have a file which I read in to a program. It processes the file and populates variou...
[4 replies] Last: Hello, @Incubbus: Well assume I have an empty class structure. Cer... (by amma)
May 2010 Pages: 1... 1314151617... 33
  Archived months: [apr2010] [jun2010]

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