Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
D

DaveE9th

@DaveE9th
About
Posts
133
Topics
55
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Help!
    D DaveE9th

    Thanks for the great example Dave, I'll spend some time with it. I did get the rand() working. Thanks, Dave :-D

    "The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson

    C / C++ / MFC help tutorial c++ lounge learning

  • rand ( )
    D DaveE9th

    I can't believe what my problem was. I'm still learning VC++ 6.0. I wanted to try some new code so I just replaced the code on my screen with the new code. I went to compile and evertyhing looked ok, it wasn't. I found something weird (at least I think it is weird) about VC++ 6.0, it doesn't compile what's on your screen unless you save it first. The source cpp file listed in my view folder did NOT change with the new code I typed in. VC++ compiled the cpp file listed in the view folder, not the cpp file I had open in front of me. So the code in front of me (that was all messed up) was seemingly compiling ok, in reality it was the cpp file in my folder that was compiling ok instead. I did get rand( ) to work finally. I used time(0) as the argument and it works great. Thanks much, Dave :-D

    "The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson

    C / C++ / MFC question help tutorial

  • Help!
    D DaveE9th

    Thanks Dave, I'll give it a try. I was trying to use the get_time( ) function, but didn't think of doing it the way you did. Is get_time something entirely different? Thanks much, Dave :-D

    "The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson

    C / C++ / MFC help tutorial c++ lounge learning

  • Help!
    D DaveE9th

    I'm trying to learn how to generate a random number (for a jukebox to play MIDI songs). I bought the C++ standard library reference book and it explains what rand( ) does, but I've not been able to get it to work yet. I don't see any complete examples. I have several books, but they don't talk about rand( ). I also have discovered the random_shuffle function as well, but don't know how to make it work. The biggest problem I've had so far with programming is to implement the code for the various functions. Anyway, I was hoping someone(s) would give me a simple working example of both 1. rand( ) 2. random_shuffle( ) I would appreciate it much, Thanks...Dave :-D

    "The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson

    C / C++ / MFC help tutorial c++ lounge learning

  • rand ( )
    D DaveE9th

    The following two code examples do compile, but only yield a message that says to press a key to continue. Shouldn't I see a random number "x" cout to the screen from rand ( ). What am I doing wrong here? #include <cstdlib #include <iostream> using namespace std; void main() { int x = (rand() % 150) + 1; cout< Here's the other example... `#include <cstdlib> #include <iostream> using namespace std; void main() { int x = rand() % 151; cout< Thanks, Dave :-D _"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson_`

    C / C++ / MFC question help tutorial

  • rand ( )
    D DaveE9th

    Bob, I'm a bit confused on the rand function being a declaration. Does this mean that rand ( ) should only appear in a header file and not in the source file. How can you tell when a function is a declaration or if it belongs in the source file? Is it because of the "int" in front of rand( ) that makes it a declaration? Thanks, Dave :-D

    "The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson

    C / C++ / MFC question help tutorial

  • rand ( )
    D DaveE9th

    Thanks, I'll try those out. Dave :-D

    "The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson

    C / C++ / MFC question help tutorial

  • rand ( )
    D DaveE9th

    I'm having a hard time getting the rand function to work. I know that rand ( ) retruns a randow number, but I'm not sure how to do it? I posted some simple code below. What should be my return? Do I just pass the highest number of my range into the argument box of rand ( )? I'm looking through my books, but have found little to help me. How do I get rand( ) to work? Also, what's the difference between rand, srand and nrand. I know that srand starts a new seed sequence but am not sure what that means. #include <stdlib.h> #include <iostream.h> int main() { int x = 150; int rand (x); return ; } Thanks, Dave :-D

    "The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson

    C / C++ / MFC question help tutorial

  • Help with program
    D DaveE9th

    Thanks all, I will work with your suggestions. Dave :-D

    "The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson

    C / C++ / MFC help tutorial question lounge

  • Help with program
    D DaveE9th

    I'm having trouble getting the following program to compile. I'm trying to write a program that will generate a random number (say our of 150 numbers for example). What am I doing wrong? My error message is 2601. I'm defining something wrong it appears. #include <stdlib.h> #include <iostream.h> void main() { int nrand (int n) { int x = RAND_MAX / n; int r; do r = rand() / x; while (r >= n); cout< Thanks, Dave :-D _"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson_

    C / C++ / MFC help tutorial question lounge

  • How to generate random number?
    D DaveE9th

    Thanks, I'll give it a try. :-D

    "The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson

    C / C++ / MFC question tutorial lounge

  • How to generate random number?
    D DaveE9th

    I want to generate a random number between a specified range of 1 to 100, how can I do this? Thanks in advance, Dave :-D

    "The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson

    C / C++ / MFC question tutorial lounge

  • How to open random files?
    D DaveE9th

    I was hoping to find some code to generate a random number. I can use a switch statement (or an array as you mentioned), but I don't know how to generate a random number. Any ideas? Thanks in advance, Dave :-D

    "The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson

    C / C++ / MFC question c++ tutorial lounge

  • How to open random files?
    D DaveE9th

    I'm working with the code below and want to make a jukebox. How can I play one of several songs randomly? #include stdlib.h int main() { system( "start c:\\cpp\\pickmeup.mid" ); /* or just system( "c:\\cpp\\pickmeup" ); */ return 0; } Thanks, Dave :-D

    "The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson

    C / C++ / MFC question c++ tutorial lounge

  • Sound question
    D DaveE9th

    Or should I say, a question about sound. The code below brings up my Windows Media Player, but I don't hear any sound. I can play other system sounds, but for some reason I don't hear any sound when I play my MIDI file. I do see the song playing, but don't hear the sound. Any ideas? #include stdlib.h int main() { system( "start c:\\cpp\\pickmeup.mid" ); /* or just system( "c:\\cpp\\pickmeup" ); */ return 0; } Thanks, Dave :-D

    "The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson

    C / C++ / MFC question c++

  • mciSendString?
    D DaveE9th

    Thanks Max :-D

    "The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson

    C / C++ / MFC question

  • mciSendString?
    D DaveE9th

    I'm trying to work with the mciSendString, but it's new to me. I've not seen it mentioned in any of the books I have. What's it used for? Tanks!!!!! Dave :-D

    "The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson

    C / C++ / MFC question

  • VC++ Problem?
    D DaveE9th

    I re-installed VC++ and it works fine now. I don't know where the file went, but IT'S BACK!:cool: Thanks, Dave :-D

    "The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson

    C / C++ / MFC c++ help question

  • D3dx8.lib?
    D DaveE9th

    Thanks, I did as you said and it worked. :-D

    "The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson

    C / C++ / MFC graphics game-dev tutorial question announcement

  • VC++ Problem?
    D DaveE9th

    I am getting a pop-up error message which says, "NMSQL.DLL, This required file cannot be loaded, Please re-install Microsoft Visual C++" What does this mean? Thanks :-D

    "The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson

    C / C++ / MFC c++ help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups