General C++ Programming - November 2011 (Page 12)

by Gldnbr
Changing up the array
 
Okay, there's more explained here than what the title says, Let's say I store a string split up into characters into an array. char a = "AE4B9"; And l...
[2 replies] Last: I ended up using switch/case statements. Thanks anyways (by Gldnbr)
Set a bool based on conditional
 
Suppose I have this simple operation: bool is_larger = someint > 5 ? 1 : 0; the conditional component itself, namely someint > 5 returns a boolean, ri...
[2 replies] Last: thanks (by ausairman)
by Gldnbr
Counting characters in an array
 
How do I count how many characters of a string are stored in an array? For example: int main() { char a = "ABCDE"; char b = "FGHIJ"; system("PAUSE"); }...
[5 replies] Last: In c and C++ all strings are arrays which end with NULL C++ provides ... (by buffbill)
Converting string to float array
 
Hi am reading a file that looks like this: 230#Louis Christakes#1000#500 130#Paul Konerko#20000#50000 It is for a bank account program in which a user...
[no replies]
Help Dynamic Array File Reading
 
Hello. I am currently looking to write a program that reads the number input by a user, searches that number within the file, then outputs the first name given ...
[5 replies] Last: Not exactally sure. The way this works is the find function searches f... (by cscho0415)
databasing and tables
 
So I am looking to create some sort of table or database in a program to store important information. It is not important to keep the information once that prog...
[3 replies] Last: Well essentially I will be making a table of device ID's and their IP ... (by cscho0415)
rtti & virtual
 
Is there a way to avoid this ugly rtti? integer dimension needed in make(). class Relation { void make() { ..... ; if (dimensions() == 2) .... ; ..... } ...
[3 replies] Last: Ooops... Yeah you right. What I am thinking? (by chameleon)
Passing Array to a Function
 
Hey Everyone, I recently ran into a problem when passing 3 arrays into a function that is supposed to move a spacestation sprite around a planet. Any help would...
[5 replies] Last: Thank you so much! That worked like a charm. (by jgeorge)
How to terminate the program from class?
 
Hello everyone ! I'm trying to terminate a program from inside a function in my class. Look Below: #include<iostream> #include<string> #include<vector> #i...
[5 replies] Last: Thanks, that's right :) (by Iamcrysis)
Help please.
 
I'm not really sure how to make my own class could someone give me some details.Btw please don't spam much i'm only 13 and trying to learn. and class as in...
[1 reply] : #include <header> or #include "local file" just (almost) copy and ... (by Mathhead200)
by mc84ss
Array of Pointers to ints
 
This is my assignment and I thought I made a program that would work, but the instructor says that we need an array of pointers. I had an array of ints that th...
[1 reply] : The syntax would look like: int **x = new int* ; . Then later to acce... (by Mathhead200)
Overloading Operators
 
I'm trying to make a dice class and I want to have a way to do something like Dice d6(); int x; x = 2 ~ d6(); where ~ takes the 2 and says "Oh! Roll the ...
[2 replies] Last: I'm about to leave so here's my code so far. main.cpp #include "dice... (by James Grider)
Class in function argument?
 
Hey, I've got two classes, a sprite class and a player class. I'm trying to pass in the Sprite class to use in the player class. For example, I have Sprite Play...
[8 replies] Last: Fine, but can you show some more code? If it's complaining about a lin... (by Pyrius)
For looping,alphabetical
 
#include <iostream> #include<string> using namespace std; int main(){ int number; string name; int a ,value; cout<<"How many people are...
[10 replies] Last: Sorry my solution when wrong on the part output that i have bold How... (by xenon69)
by myx360
final integer in loop not passing to function
 
C++ problem Hi, I have 2 arrays of objects set up and they seem to be working fine. but I have a while loop set up in the main method. its setup is: int MAX...
[3 replies] Last: myx360 that was simple and good .... (by bluecoder)
Regarding main() function
 
Where does the value returned by this code go ? int main() { /* Prg Code */ } Can we do something with this returned value?I mean to do things...
[1 reply] : Normally this value is returned directly to the operating system, but ... (by Computergeek01)
Frustrated by a problem I don't see !
 
Hello everyone ! I'm having a weird problem after execution. Here's my code : #include<iostream> #include<string> #include<vector> using namespace std; ...
[3 replies] Last: int main() { string Number_, Description_; double Price_; int Quantit... (by bluecoder)
WASD Key movement c++
 
Hey everyone, first board post here. Taking my first c++ class and i need help with my dungeon crawler i am building. So far i have my character movement set up...
[7 replies] Last: Thanks for the help everyone. I ended up using the switch statement si... (by pegleg123)
y not void main() ?
 
I have heard many times dat void main() is not standard c++ and one should use int main() and return 0.....it makes no difference ..den wats d big deal ??
[7 replies] Last: @OP if you're developing a command line utility then the return value ... (by ceruleus)
Tell me the working of this simple line
 
1.int x=10,y; 2.y = x++ + ++x; In line 2 the compiler starts the processing (or whatever its called, if its something else do tell me) from the right side (...
[2 replies] Last: The expression x++ + ++x is an error in C++ (and in C, for that matt... (by Cubbi)
November 2011 Pages: 1... 1011121314... 47
  Archived months: [oct2011] [dec2011]

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