Beginners - April 2014 (Page 3)

Measuring elapsed time
 
What is the best and/or simplest way to get and measure the difference between two times? I saw this but wanted to know if there was a better or different wa...
[1 reply] : Hi, time() returns time in seconds, while clock() returns time in mil... (by closed account 2AoiNwbp)
How to add in a random seed. with desired input (1,2)
 
hi i am doing a program that requires me to input a random seed (already chosen) and input a maximum of 5 friends to text, randomly choose one and output the ch...
[28 replies] Last: Your welcome =D (by closed account j3Rz8vqX)
by Cobain
Help with Classes & Objects
 
Hey guys,this is my first attempt at writing Object-Oriented code, so please forgive me if some parts of it appear muddled, they probably are. The problem I'...
[2 replies] Last: Worked perfectly, thanks for your help Peter87! (by Cobain)
Im getting a huge number which is incorrect. please help.
 
I am brand new to coding and am trying to learn it myself, Im a business major thinking about switching to computer science, I am stuck with an basic if else st...
[4 replies] Last: Thank you very much. :) (by closed account G20RfSEw)
2D Array Class constructor and operator[]
 
so to use in a bigger program I have to write a two dimensional array class, using a provided 1d array class (inheritance). I'm really stumped on writing the no...
[6 replies] Last: Thank you. Got it. That's the reason for line 15 in your code. It per... (by closed account D80DSL3A)
by Tieria
In class sample program demonstrating header files won't compile?
 
Hey guys, In my C++ course we have just started dealing with programs that are comprised of a header, implementation and a main file. I am trying to get a...
[7 replies] Last: Oh ok, thanks! (by Tieria)
Returning a pointer to a structure
 
Can someone help me fix this program, it need to return a pointer from this function, but i dont understand how to do so. #include <iostream> using names...
[11 replies] Last: I solved it and got everything formatted. #include <iostream> using... (by derpmaster)
robot
 
even if i push the up or down key it wont change the feet number it always thinks its 20. Also how would i put a cap for the feet -1 and feet +1 look in comment...
[1 reply] : i fixed it #include <iostream> #include <windows.h> #include <coni... (by kmtompkins)
Calling 2D vector elements is causing a crash?
 
Hi! Right now I'm trying to just have the grid() function print out the initialized tic tac toe board. It all compiles successfully but, for some reason I can't...
[2 replies] Last: Oh, wow. I feel silly. I should probably practice with scopes of func... (by ECEsasha)
Need help!
 
I am trying to close the input and output files in my functions after im done with them, but i am getting errors when i pass the file name in. I cannot figure o...
[1 reply] : void pay_report(string, string, ifstream, string, char, float); // ... (by nvrmnd)
increasing numbers
 
the error im getting is "operator has no effect; expected operator with side-effect" on lines 19 25 i also think this is the problem im having on my other progr...
[1 reply] : n+1;//isn't doing anything. n++;//is incrementing the value of n by 1... (by closed account j3Rz8vqX)
Help with code for counting the occurrence of NUmbers
 
Hey guys, I am still new to C++ programming and I really need your help, I am trying to write a code that outputs a histogram of student grades. The program det...
[3 replies] Last: Thanks guys I think most of the problem came with my sorting loop. I h... (by closed account Eh5fjE8b)
Getting a Total
 
I've been having trouble getting all my cin amounts to add together for a total amount that I can use within a void statement.
[5 replies] Last: the other way would be to use reference variables, but that's a tiny b... (by pepstein)
key pressed
 
how would i read if different keys are pressed and output accordingly. #include <iostream> #include <windows.h> #include <conio.h> #include <cstdlib> ...
[1 reply] : if( GetAsyncKeyState( VK_LEFT ) & 0x8000 ) (by closed account j3Rz8vqX)
by Fner
Need help with a running total
 
So basically i need to keep a running total of the amount of tickets, single and return ticket, amount of stops and the total price. Any help would be greatly ...
[4 replies] Last: Still can find a solution. Think i may be putting it in the wrong plac... (by Fner)
I NEED URGENT HELP?!?!?
 
During a loop (for loop), say the user inputs a number and the loop repeated itself the number of ti.es the user inputed. During these repeats, the user inputs ...
[1 reply] : you could just create a variable called total or something and have a ... (by pepstein)
What should I do after reading Accelerated C++, and also Programming Principles and Practice Using C++?
 
I've got two great books, Accelerated C++ by Andrew Koenig and Barbara E. Moo, and also Programming Principles and Practice Using C++ by Bjarne Stroustrup. ...
[no replies]
Maze game, inputting into 2d vector
 
I am attempting to create a maze that is imported from a file and then placed into a vector that holds a vector of bools but I am not good yet with vectors. My ...
[1 reply] : any ideas on how to do this? (by pepstein)
help please!
 
sorry I just can't figure this out. I want to output an error message whenever I input letters and numbers with letters. please help! thanks! #include ...
[5 replies] Last: thankyou again! very much appreciated. (by emeriffic6969)
What will this rand generate?
 
Can some one help me what will AJ =(( rand() % 20 ) + 1) * 100 ; generate and how does generation take place?
[1 reply] : It will create a random value. Then mod it by 20; limiting its value ... (by closed account j3Rz8vqX)
April 2014 Pages: 12345... 67
  Archived months: [mar2014] [may2014]

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