General C++ Programming - October 2016 (Page 17)

C++11 <random> is not random?
 
I'm having a heck of a time with C++11's <random>. First I tried seeding with random_device and that worked on Mac/Clang and Windows/Visual Studio, but it's bro...
[6 replies] Last: > why not let uniform_distribution be static too? With this call sign... (by JLBorges)
Static local variables- C programming
 
1) Write the definition of a function named averager that receives a double parameter and return-- as a double -- the average value that it has been passed so f...
[5 replies] Last: You actually have 2 problems in the code you pasted. Both are in line... (by doug4)
Tricky C Program
 
#include<stdio.h> int main() { int a,b,c; int count = 1; for (b = c = 10; a = "- FIGURE?, UMKC,XYZHello Folks,\ TFy!QJu ROo ...
[1 reply] : It is relatively easy, just obfuscated. It prints three characters: '... (by coder777)
ppm file
 
//i had a problem to the constructor when i try to initialize and call the Image() constructor;
[7 replies] Last: i did it thanks man!!!! now i call the constructor correctly! the prob... (by tonerognwrizei)
Loading vector with bit matrices
 
I have a code segment here that loads zeroes into a vector that represents a bit matrix. When the program runs and tries to write the result in a output file I ...
[14 replies] Last: In your Write() method: [code firstline=8] for( count = 0; count... (by MikeyBoy)
RTTI Runtime structure data
 
I'm writing an inter-process shared memory interface and I'd like to share structures with other applications. Allocating the right amount of memory and assi...
[1 reply] : If you don't want to use the same struct on both ends the simpliest wa... (by coder777)
Deallocating a vector of vectors
 
If I have a vector of vectors with a custom data type (A struct in my case, std::vector< std::vector<MyCustomDataType> >) how would I deallocate this? Thank ...
[1 reply] : std::vector manages memory itself. If you store pointers in there, ... (by JayhawkZombie)
Need help inputting values with switch statements.
 
Hello, I'm currently writing a program that determines the cost of a travel based on travel distance, mpg, gas type, and either state (Michigan or Ohio). I am g...
[4 replies] Last: That makes a lot of sense the way you explained it! Thanks so much! (by MisterBren)
binary numbers
 
cout << "Ivesk sveikojo skaiciaus dali " << endl; string sveikojiDalis; cin >> sveikojiDalis; cout << "Ivesk trupmenine skaiciaus dali " << endl; stri...
[1 reply] : By writing your code full of text in foreign language, you are making ... (by SakurasouBusters)
Creating a new array at each function call
 
I'm creating a program where my main calls a function that creates an array by getting user input and then sends back the pointer to the array back to main... ...
[1 reply] : You need to allocate the array on the heap. then return the pointer fr... (by closed account LA48b7Xj)
Multithreading
 
I have created a simple text based game where the player can move in a grid(using a 2D array) and the basic map is as below>>> P - Player D - Danger G - Gold ...
[2 replies] Last: Something I can see that looks like a mistake is your canThePlayerMove... (by closed account LA48b7Xj)
by Najah
Missing function header ( old-style formal list?)
 
Hey , I can't find my error here .. can anyone help ? #include <iostream.h> { cout << "hello!" << endl ; int x ; cin >> x ; return 0; } W...
[2 replies] Last: add int main() before { (by coder777)
by yes123
Structure Error
 
I am creating a program that displays the name and salary of the two employees however I do not know what is the code for the calculation of the salary in struc...
[6 replies] Last: It was solved. I changed the gets() and puts () to cout and cin and ma... (by yes123)
3d game engine function
 
Hi guys, I'm developing a game engine. I need just one more function for it to be functionally operational. I need a function to determine where a line i...
[6 replies] Last: The assumption in the posts above (which isn't necessarily reasonable ... (by mbozzi)
Please give me a hand ( for SinglyList.cpp ) to use array method to rewrite the insert data of part , thx lot !
 
main .cpp #include "Node.h" #include "SinglyList.h" #include "MySinglyList.h" #include <iostream> #include <string> using namespace std; int main()...
[no replies]
Dice Game
 
Need some help on how to develop a function to search for consecutive identical integers in an array, and to replace those integers with double that integer. ...
[2 replies] Last: Make one pass through the array, keeping track of two positions in the... (by JLBorges)
Looping calculations and outputting them?
 
I'm having trouble writing the correct loops for an assignment. I have all the Math and Functions written; I'm just having a hard time understanding how to writ...
[6 replies] Last: How would I write that in the loop that I have already? (by McNasty49)
Finding the difference between two dates C++
 
Hi, I'm a student and I was wondering if anybody can help me debug one of my functions. For this program the user is suppose to input two dates in the format mm...
[3 replies] Last: I can't see anything wrong with your ChangeToNumber function. However,... (by filestream)
How to use array method rewrite the insert data of part , Thx lot !
 
#include "SinglyList.h" #include "Node.h" #include <string> #include <iostream> using namespace std; SinglyList::SinglyList() { head = NULL; } Si...
[1 reply] : http://www.cplusplus.com/forum/beginner/199513/ (by SakurasouBusters)
Is this the proper convention for a vector accessor and modifier?
 
Due to std::vectors being of unknown size, this is the proper way to optimize, correct? const std::vector<Point>& get_path() const {return path;} void set_pat...
[1 reply] : It is fine. Worth considering: const std::vector<Point>& get_path()... (by JLBorges)
October 2016 Pages: 1... 1516171819... 23
  Archived months: [sep2016] [nov2016]

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