General C++ Programming - May 2014 (Page 28)

Random Numbers
 
How do you do this... Write an instruction to generate a random number in the range -501 to + 50 inclusive.
[4 replies] Last: use this int random_number; random_number = 501 + rand() % (50); ... (by IGI30)
by IGI30
Mouse coordinate position in window
 
After searching on stackoverflow I got this POINT p; for (int i = 0;; ++i) { HWND hwnd = GetConsoleWindow(); system("cls"); if (ScreenToCl...
[5 replies] Last: OK thanks I'll do second one. because 1st one will be slower. (by IGI30)
switch/menu compiling problems
 
Hello all, I'm trying to write a program that has a menu with a switch statement. I'm getting "case label'1' not within a switch statement" and subsequent e...
[2 replies] Last: Good eye. I did add that since posting this. Still getting the errors.... (by njrobby)
adjacency list graph representation
 
"My Programm is crashing and i dont know why can anyone help..?" #include<iostream> using namespace std; int arr ; struct edges { int...
[1 reply] : http://www.cplusplus.com/articles/z13hAqkS/ (by Yanson)
by Kingv
help on final project
 
I'm writing a fantasy store to purchase items from and need help passing the arrays, I know I need a switch statement; but I just kind of hit a snag and could u...
[2 replies] Last: #include <iostream> #include <string> using namespace std; class I... (by Kingv)
Executing Loops
 
How many times will the body of the loop below execute? for ( int index = 0; index < 10; index++) { if (rand() % 3 < 3) continue; else break;...
[2 replies] Last: I don't get it. Doesn't it take less time for the OP to read chapter ... (by prestokeys)
gather 2 parameters and send, POST wininet [Help]
 
I have a problem I need to post two parameters via wininet so I can save in a mysql database. So I was thinking how do I string two parameters. My code goes lik...
[1 reply] : Concatenate like in your third example. However, note that you may ne... (by Stewbond)
More Loops
 
Assume you want to use a loop to process an array of characters starting from the beginning of the array. You want the loop to stop when you read the null termi...
[1 reply] : a variation: for ( int index = 0; array != '\0'; ++index ) { char ... (by Stewbond)
Reading from a file
 
Assume you want to read from a file and place the data from the file into an array. The array can hold 10 integers. The file may contain any number of integers ...
[2 replies] Last: Why are we still doing OP's homework for him? (by Duthomhas)
STRANGE CASE QUICKSORT
 
Well I am following the program with this line of numbers to sort it with quicksort, I am writing every step on a blackboard to understand it better, but there ...
[3 replies] Last: I SOLVED IT (by paoloben9)
Positive numbers and dividing
 
Assume you want to make sure that the user enters a positive number that is divisible by 10 with no remainder. Write the condition you would use in the followin...
[2 replies] Last: Please, no one answer his questions, else he will get encouraged to ke... (by prestokeys)
Simulate Pairs card game
 
Write a C++ program to simulate Pairs card game. The game is played by two players. It will ask user to choose two cards from a matrix and try to find the pairs...
[3 replies] Last: He may be clever but he's not helping you learn c++ by doing it for y... (by Codermik)
Returns
 
Assume you have a function that needs to return 3 data items. What would be the best approach to use? Pick the one best answer. A. Use a return statement to re...
[2 replies] Last: There are situations where D would be a valid choice. For example, a f... (by helios)
by ezt
how to make the output 0.0000000001
 
I want to convert energy from joules(J) to gigajoules(GJ) 1 joules = 0.000000001 GJ and i use this---> printf("\nEnter the value of length to be c...
[2 replies] Last: ats15, Thank you! It works!:) (by ezt)
by al1432
Prime numbers
 
So I need to write a program which tells the user if the number they input is prime or not. I have done so and included the code below. My problem is that I ne...
[5 replies] Last: You should use a prime sieve for finding the primes. (by giblit)
by CRooky
print stars function in 1D array..??
 
I'm having trouble with my for loop near the end of the program was able to print everything else can anyone give me a boost here..?? Feelin stuck...No errors r...
[2 replies] Last: So I will seriously quickpay someone to finish this code for me...! LB... (by CRooky)
Singleton Patern
 
Hi guys, I was given assignment which I'll post below. I'm having problems doing it because every website i read is too difficult to understand for me because m...
[4 replies] Last: Sorry, but it won't let me delete my previous post. The line static ... (by prestokeys)
Big numbers in Arrays
 
i have to create three arrays. my first array is going to be a 20 digit number if not less. this also goes for my secnd array. Please enter first number -->...
[17 replies] Last: I think it's better practice to not put stuff like that in main. Put i... (by JasperBraun)
Puzzling Linker error messages!
 
Hey guys, I am writing an address book program. It has multiple header files and their corresponding implementation files. The program compiled and ran perfe...
[4 replies] Last: > it would not help my situation since I am using an IDE that was your... (by ne555)
Adding Reciprocals - Loop
 
How to do the problem below using loop? Using loop... Output the total of the reciprocals of the numbers from 1 to 10: 1/1 + 1/2 + 1/3 + 1/4 ... + 1/10...
[3 replies] Last: That may only iterate 9 times. I would use an int for your loop iterat... (by giblit)
May 2014 Pages: 1... 262728293031
  Archived months: [apr2014] [jun2014]

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