Jump to content

Search the Community

Showing results for tags 'c++'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • OSBot
    • News & Announcements
    • Community Discussion
    • Bot Manager
    • Support Section
    • Mirror Client VIP
    • Script Factory
  • Scripts
    • Official OSBot Scripts
    • Script Factory
    • Unofficial Scripts & Applications
    • Script Requests
  • Market
    • OSBot Official Voucher Shop
    • Currency
    • Accounts
    • Services
    • Other & Membership Codes
    • Disputes
  • Graphics
    • Graphics
  • Archive

Product Groups

  • Premium Scripts
    • Combat & Slayer
    • Money Making
    • Minigames
    • Others
    • Plugins
    • Agility
    • Mining & Smithing
    • Woodcutting & Firemaking
    • Fishing & Cooking
    • Fletching & Crafting
    • Farming & Herblore
    • Magic & Prayer
    • Hunter
    • Thieving
    • Construction
    • Runecrafting
  • Donations
  • OSBot Membership
  • Backup

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


MSN


Website URL


ICQ


Yahoo


Skype


Location:


Interests

Found 2 results

  1. Just finessed an internship at Raytheon for software engineering this summer. From my talk with them, it seems that I will be exclusively be using C/C++. I'm finishing my Junior year in University and I have mainly been using Java and haven't really touched C/C++ in over a year. Was wondering you guys would have some projects that you would recommend that touches on a lot of concepts in C++/C so that I can re-familiarize myself with it before the summer begins.
  2. So my wonderful CS teacher has decided he's going to make our class revolve around ease for himself(instead of trying to make his students better at programming).... BUT ANYWAYS....He gives us little info on how the program is to be written, and if we don't write it EXACTLY like he would, we don't get credit. I think I have written a working program(that does what he asks), but the hidden test cases keep failing so I could really use some help. INSTRUCTIONS Write a function that takes an integer “count” and a double “probability" Generate “count” random numbers between 0.0 and 1.0 Print the number of generated random numbers that is less than “probability” Call this new function from main() MY CODE #include <iostream> #include <cstdlib> using namespace std; int newFunction(int count, double probability) { double random; int total = 0; for(int i = 0; i < count; i++) { random = (double) rand() / RAND_MAX; if (random < probability) { cout << random << endl; total++; } } return total; } int main() { cout << "Enter integer for seed: " << endl; int seed; cin >> seed; srand(seed); int c; double p; cout << "Enter the count of numbers to be generated: " << endl; cin >> c; cout << "Enter the probability: " << endl; cin >> p; cout << "Number of generated random numbers less than probability entered is " << newFunction(c, p) << endl; return 0; } PROGRAM INPUT 1 //seed 3 //number of random numbers (count) 0.5 //value for probability MY OUTPUT Enter integer for seed: 1 Enter the count of numbers to be generated: 3 Enter the probability: 0.5 0.394383 Number of generated random numbers less than probability entered is 1 HIS OUTPUT Enter integer for seed: 1 Enter the count of numbers to be generated: 3 Enter the probability: 0.5 0.159812 0.216901 Number of generated random numbers less than probability entered is 2 He gave us this as a skeleton for the code: #include <iostream> #include <cstdlib> using namespace std; int newFunction(int count, double probability); int main() { cout << "Enter integer for seed: " << endl; int seed; cin >> seed; srand(seed); int c; double p; cout << "Enter the count of numbers to be generated: "; cin >> c; cout << "Enter the probability: "; cin >> p; cout << "Number of generated random numbers less than probability entered is " << newFunction(c, p) << endl; return 0; } I don't have a clue as to what I'm doing wrong. He uses an online textbook where he inserts his "key code" then when we run our code it compares the outputs and determines if they are the same. We are using the same compiler, and I am almost positive we are to use rand(). Please, I really need help...Thank you
×
×
  • Create New...