Beginners - July 2014 (Page 22)

Conditional -- if a letter or number key is pressed
 
I'm using SDL 1.2 and I'm trying to figure out how to write an if{} statement that will call a function if the user presses a letter or number key, or basically...
[3 replies] Last: I'm glad I was able to inspire you a bit. I see no problem with your a... (by xismn)
by wharp2
Using Vectors!
 
I am having some trouble. I am supposed to do the following: 1. Create a Vector to hold a set of exam scores. 2. Read exam scores into a vector ...
[16 replies] Last: ugh that for loop :P It should be for(int i = 0; i < exam_scores.size... (by giblit)
I really can't figure this out...
 
I am trying to create my own version of the NIM game. Ok so when I build and run this every thing is smooth until it is computer's turn in which it subtracts 19...
[7 replies] Last: I've Solved it! The problem is here! remainder = total % x; remainder... (by NeonOrange)
Simple addition in while.
 
Hi :) Let's say I have a file with numbers, each on a line. Which is the most simple way to sum up the numbers from the file, using as less variables and inst...
[2 replies] Last: Thank you. I was wondering if one can do this with just a variable. (by Guzfraba)
Changing the value from "deep" function
 
Hello, I got a program and there is a function which has a function inside and that inside function has a function etc etc. and in one of really deep functions...
[10 replies] Last: Yeah, I think I get this. In my game battle is a function which is mad... (by Furjoza)
Comparing floating-point numbers
 
I've some questions regarding comparison of floating-point numbers. In this book: http://kysmykseka.net/kysmyk/Wizardry/Game%20Development/Programming/Real-Time...
[4 replies] Last: Well, 1010-100 = 910 > 0.1, so the numbers aren't equal... I suspect ... (by helios)
Passing 3D array as a 2D parameter
 
I'm working on a project where I need to reuse functions that were meant for a 2D array but with a 2D portion of a 3D array. Say I have a 3D array called board...
[2 replies] Last: Awesome! That made sense. From there I was able to figure out that I ... (by ittociwam)
enum class cast?
 
I am trying to set the value of an enum class type object with the value given by the user from the command prompt. #include <iostream> enum class EnergySta...
[4 replies] Last: Of course. How simple. Yet another one of those moments when I feel st... (by squarehead)
by yepMe
Name control exercise problem
 
Thinking in c++ has this question : Create a class containing an int, a constructor that intializes the int from it's argument , and a print() function to disp...
[2 replies] Last: Thanks it's working now :) (by yepMe)
How else can I write for(double temp; cin>>temp;)?
 
I'm very new to programming and having a hard time understanding how the loop condition works when prompting the user for input. For example you can write ...
[3 replies] Last: The first example is a range-based for loop. The other two are normal ... (by giblit)
by Lu Bu
Is there a difference
 
Is there a difference declaring a function like this: int exampleFunction() { return value;} or like this: const int exampleFunction() { retur...
[3 replies] Last: The word "const" in "const int exampleFunction()" has no meaning. Ther... (by Cubbi)
Could use some help, please.
 
Hi, First let me say thank you in advance to anybody who is willing to take the time to help me out. I am a VB6 guy from way back trying to update my pro...
[7 replies] Last: Awesome, thank you again! (by Ash Telecaster)
How to find max and min? (C-Program)
 
I'm trying to make a program which asks user to enter the number of pancakes eaten by ten people. Then it is supposed to tell "The maximum and minimum" amount o...
[5 replies] Last: Your current code has a flaw: the pancakes_max/min are uninitialized. ... (by keskiverto)
Reversing a word
 
We just started c-strings in a summer class I'm taking and part of my assignment is the following: Create a function that will reverse the characters in a C-...
[19 replies] Last: I chose 23 to add 2 extra characters to the array for the 'es.' It's s... (by ksmarine1980)
How to Add a New Header in Visual Studio 2013
 
I have written a simple program which has a class in header a file and I am making use of it from a *.cpp file. The code is correct, however I am new to Vis...
[1 reply] : All of the files for your program have to be in the same folder. That'... (by Yay295)
broken comparisons?
 
I am having an issue getting this function to set these nodes properly. I don't know if I am just overlooking something or what.... void insertTokens(lis...
[4 replies] Last: I'm not sure what changes I could make to insert it differently. (by elite zero)
by Ganado
4-byte Big-Endian file reading
 
I am trying to understand Disch's tutorial on binary files (http://www.cplusplus.com/articles/DzywvCM9/ ). Trying to learn based off the above link and this pi...
[5 replies] Last: Yep I deleted what I had, I saw the mistake right away :p Guess I didn... (by Ganado)
Need Help with Array Loop Exchange.
 
Hi y'all. I'm new here and new to C++. I've been doing ok with C++ but i'm struggling with this assignment. I am supposed to write a program that declares ans i...
[14 replies] Last: The size of the array doesn't change. x should be declared as a consta... (by Chervil)
#include files from another project in Visual Studio Solution
 
I am attempting to use code from another solution in a different solution. I am trying to include the header file from a different solution, in my open solution...
[6 replies] Last: I know that I can add the entire other file to my current project, th... (by AbstractionAnon)
Beginners should take a look at this :)
 
I know this isn’t the "correct" place to post this. But as the goal of this post is targeting beginners,its the best place I see fit. (yes this was writt...
[no replies]
July 2014 Pages: 1... 2021222324... 43
  Archived months: [jun2014] [aug2014]

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