Beginners - May 2013 (Page 32)

Can I initialize an array within a class header file.
 
Hi, I have been making a simple tetris game and so far it's just a linear main.cpp file. I understand that I should be trying to encapsulate the program, so ...
[11 replies] Last: So, it's better if I suggest you another way, trust me. There we go, ... (by S G H)
Square root function help! (1,2)
 
Im trying to make a square root function that increments the double variable i by 0.1 every loop, however its not working. here's the code. int m; dou...
[32 replies] Last: #include <iostream> #include <iomanip> int main() { double d = 0... (by MiiNiPaa)
Array of arrays, tree of data
 
Write your question here. I have two arrays, data1 and data2. Each has 2x256 data values (basically they are tables of amplitude vs frequency) I would like to...
[7 replies] Last: Oops my bad. It should read double data1 ; double data2 ; but ... (by TheSource007)
Duplicate Case Values?
 
Hello all, Recently, I started making a 'text-based adventure' game. I'm using the switch and case gates, but I'm getting an error. Here's the code. ...
[13 replies] Last: Thank you Cire! I have taken your advice, and now at least it works, b... (by ejuneau)
by riol94
How to sum 2dimensional arrays
 
I wrote this code in c++ but i m stuck cause i have to sum the 2 arrays i dont know how.Can someone please hep me out?? #include <iostream> #include ...
[1 reply] : It is enough to say that this function int arraySum(int A ,int B )... (by vlad from moscow)
by Hihelp
Error
 
Been trying to figure out how to print out the right numbers from the class int Die::get_value() { return value; } void Die::roll() { int value...
[3 replies] Last: your value variable is local to roll() function and cannot be used o... (by MiiNiPaa)
Swapping nodes in a doubly linked list
 
How exactly should one go about doing this? I wrote a function that swaps two consecutive nodes, but then I realized quite a few problems: 1.) The nodes...
[2 replies] Last: With correct algorithm you actually need only to check for (2) case Wo... (by MiiNiPaa)
Problems Understanding Final Program
 
I desperately need help with my final program in a C++ Programming class. I'm sorry, I know that it's frowned upon to bring problems like this to the forum, but...
[8 replies] Last: This doesn't compile. Your printBarn() function is missing a closing b... (by booradley60)
Number of questions
 
Write your question here. #include <time.h> int main() { int Die1; /*Random Number 1-6*/ int Die2; /*Random Number 1-6*/ int Total; /*Total valu...
[2 replies] Last: That was perfect! Thanks, easy fix for that part, guess it was the eas... (by sam1194)
How do I convert a std::vector into std::array
 
I always store object sequences in vectors for the obvious benefits they bring, but am now in a situation where I frequently need to access data as arrays (I'm ...
[7 replies] Last: Ok thanks for that. (by ausairman)
A game about programming :)
 
(Updated the game removing some minor bugs) (NB!!! The game is created for 960x600 so make sure your browser is at least that size) Hey fellow programmers, I ...
[2 replies] Last: I want to teach as it does. But I just found some games where it kinda... (by sqdejan)
by Doggie
String Subscript Out of Range (Line 1662)
 
Removed!
[1 reply] : Do not double post http://www.cplusplus.com/forum/general/102167/ (by MiiNiPaa)
by Dal
User input in array from class
 
Hello, first time posting! Trying to write a program where the user input get stored in an Array from a class. (don't know if that makes sense) I have a c...
[3 replies] Last: Hate to bump, but havnt gotten any further. :/ So im suppose to have ... (by Dal)
by new2c
array:How do check for duplicate numbers?!
 
I'm stuck on my lottery game. I got mostly everything to work but the part where the program checks if the user numbers and computer numbers have duplicates in ...
[5 replies] Last: In fact this code bool isDuplicate( const int arr , int size, int nu... (by vlad from moscow)
Code Validation
 
Didnt know any better Title ;) I just wanted to know if the following code is bad or good or neither of both. And if it's bad what could I improve? Tha...
[1 reply] : After a quick glance, I can see three issues: 1) I would change your ... (by closed account zb0S216C)
confuse on i++ and ++i
 
Hi, everyone i know this is easy for you but i just have no idea about the difference between i++ and i--.. see the following code, #include <iostream> usi...
[3 replies] Last: The postfix increment/decrement operator will increment/decrement its ... (by closed account zb0S216C)
by AdyR
HELP for one aplication
 
Hi there. I just registered here and i need some help. I have to do a small application that allows me to display random circles in a given rectangle. These cir...
[no replies]
by Pierce
cin.ignore only working at a certain point :S
 
Hiya, New to C++ (Thats why this is in the beginners section! =) ) and I'm having a bit of trouble with cin.ignore(), and asking my program to prompt before co...
[6 replies] Last: Well the problem was clearing the buffer at the end of sporttest(), so... (by Pierce)
by sumsar
Why am i getting an error when i try to compile this?
 
Im making a small game and I having some problem compiling the board. what am I doing wrong? #include<iostream> #include<string> using namespace std; ...
[5 replies] Last: okay thanks for the help. (by sumsar)
by theguy
edit: need some help
 
Thank you!
[6 replies] Last: @nedo: you are stopping too late while( geline(input, line) ) ... (by ne555)
May 2013 Pages: 1... 3031323334... 66
  Archived months: [apr2013] [jun2013]

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