General C++ Programming - October 2012 (Page 19)

by Tirana
take input
 
how to take the following code? When you get the line over 0 and when you take -1 finish input: 1 2 3 4 1 0 3 2 1 8 4 3 2 0 1 2 0 -1 thank you for help...
[no replies]
identifier not found?
 
#include <iostream> using namespace std; int main() { double rate; double hours; double amount; amount = getSalary(hours, rate); cout << " The total salar...
[11 replies] Last: BTW, I believe your overtime calculation is incorrect. You're calcula... (by sam1212)
Program Help: Compiles but doesn't run right
 
I have written out the program, the program compiles and when it runs, it'll run the prompt, and when you input a number and press enter, it'll go to the next l...
[1 reply] : Hello, The reason its not moving onto the next step is because the va... (by Tyler Hummel)
overloading operator puzzle: return *this, or temporary variable?
 
class Integer { int i; public: Integer(int ii) : i(ii) {} Integer operator+(const Integer& rv) const { // version 1 return Integer(i + rv.i); } ...
[4 replies] Last: TheIDeasMan wrote: When overloading, the arguments have to differ ... (by TheIdeasMan)
by oscott
Why won't this code compile?
 
#include<iostream> int main() { int length; std::cout << “\nPlease key in the length of your array”; std::cin >> length; int array...
[5 replies] Last: It's not about the array. Pasting the code to C::B gave a lot of error... (by maeriden)
by Vy C
Still learning :)
 
Okay, So I have a class called songs. I have about 4 songs that i would like to randomly pick one of the 4 songs. I was working on a small program to try a...
[3 replies] Last: #include <vector> #include <cstdlib> #include <time> using namespac... (by pogrady)
by Dega
Linked List Template Class Insertion
 
Hi. I have been scratching my head trying to find out why I am getting a crash every time I try to use the insert() method in a Linked List template class I a...
[8 replies] Last: Yah it can be done with a pointer to a pointer pretty easily, or if it... (by closed account o1vk4iN6)
need urgent help
 
jkygbylbihuhnnb;i
[2 replies] Last: easy just sort the array based on random something like bool f(){ ... (by rmxhaha)
by SMA01
Assert not working correctly?
 
I have to include an assert for a credit card program, that makes sre the length is between 13-16. Is this correct formatting? Because I enter valid lengths and...
[7 replies] Last: if your functions isn't void, you need to return a value; (by closed account 2wpSLyTq)
How to Make a dynamic memory that is contigeous
 
I have a homework,I need a dynamic memory allocated to a pointer **p. and have the *p also dynamically allocated and the memory is contigeous to **p. Which mea...
[7 replies] Last: I am aware that this is a C++ forum, and I am also aware that most C+... (by cire)
Help Please
 
If someone could please help me with this program 1. Write a C program that prints numbers from 1 to 104, each 8 numbers on a separate line, at the end of ea...
[4 replies] Last: If you use that formula, you have to increment after the if statement,... (by BrentSpinor)
C++ Array help
 
Hello, I need a little bit of help for a c++ program, on shuffling cards. If you could help that would be greatly appreciated, and just reply here. Thank...
[4 replies] Last: i appreciate it (by closed account 2wpSLyTq)
by su li
help with switch!mine is not work it...
 
#include <iostream> #include<cmath> using namespace std; int main() {int x; char time, charge; cout<<"case 1<=2hours,case 2<=3hours,case 3<=4hours,case 4<...
[2 replies] Last: u can cin to a string class object (by Aramil of Elixia)
uRGENT on ARRAY
 
I am trying to use an array to stored some values and allow the user to guess the number between 1 and rand_max and make the user know if the number is too hig...
[no replies]
by Alx101
SDL 2.0 GL 3.3 no render
 
I am trying to use SDL 2.0 in my game engine to handle all the window related specifics, but i can't seem to be able to render anything to the screen :S Rele...
[3 replies] Last: It does no diffrerence, i still don't get any render. (by Alx101)
Problems with cin and GetAsyncKeyState()
 
Hey guys! I'm building a program for school, and it's supposed to have a menu. You must be able to navigate the menu using the arrow keys. I decided to use G...
[5 replies] Last: clear() will only clear cin's flags. I tried using ignore(), but it on... (by SuperSonic)
Memory Sizes
 
I am wondering why I miscalculate the memory used....... Here is the code #include <iostream> #include <vector> using namespace std; int main() { ...
[4 replies] Last: There is probably some overhead with the dynamic allocation. It looks ... (by Peter87)
Writing binary string to file in binary
 
Okay, I'm working on a Huffman encoding project. Basically I just need to know how to write a string to a binary file. I have a string consisting of all 1s and ...
[1 reply] : one character is one byte (8 bits). You could shove groups of 8 binary... (by strongdrink)
How To properly use Clear Screen?
 
Can anyone help me? I made complete program and i managed to loop it but the problem is that the previous console wont disappear can any one help me on what co...
[3 replies] Last: Perhaps you should tell us what exactly you want to see happen. (by Duthomhas)
by dalawh
Array as a parameter
 
Is there a way to find the length of an array that is passed as a parameter?
[12 replies] Last: Correct. (by Duthomhas)
October 2012 Pages: 1... 1718192021... 50
  Archived months: [sep2012] [nov2012]

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