Results 1 to 2 of 2

Thread: random number guessing program

  1. #1
    hassannasir is offline Senior Member+
    Last Online
    30th December 2023 @ 06:31 PM
    Join Date
    06 Jul 2020
    Gender
    Male
    Posts
    171
    Threads
    53
    Credits
    686
    Thanked
    0

    Default random number guessing program

    اس کوڈ میں کیا غلطی ہے؟ ہر بار پروگرام کو رن کرنے کے بعد ایک ہی نمبر کیوں آتا ہے؟
    #include <iostream>
    #include <stdlib.h>
    #include <time.h>
    using namespace std;
    main()
    {
    int z;
    int trynum;
    int i;
    srand(time(0));
    z= rand()/327.67;
    while(trynum!=z && i<6)
    {
    cin >> trynum;
    i = i+1;
    }
    cout << endl << "value is " << z;
    }

  2. #2
    Join Date
    09 Apr 2009
    Location
    KARACHI&
    Gender
    Male
    Posts
    19,306
    Threads
    412
    Credits
    39,750
    Thanked
    1813

    Default

    کسی زمانے میں سی کو انسٹال کیا تھا
    انتظار کریں کوئی متعلقہ دوست آکر ریپلائی کرے گا

Similar Threads

  1. program for Finding EVEN and ODD number
    By Abidalicu in forum C++
    Replies: 4
    Last Post: 14th March 2016, 11:14 PM
  2. Simple Guessing game in C++
    By Ahsan ANC in forum C++
    Replies: 10
    Last Post: 17th February 2016, 07:41 PM
  3. Random
    By adnmirza in forum Tanz-o-Mazah
    Replies: 9
    Last Post: 11th August 2010, 04:22 PM
  4. Random Pics
    By editorshahid in forum Baat cheet
    Replies: 22
    Last Post: 28th March 2007, 04:59 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •