Make a game in which you guess a number

Assignment Help C/C++ Programming
Reference no: EM13161144

Make a game in which you guess a number between two set numbers to find the answer, the game should tell you if you are too low in your guess or too high. For example

Guess a number between 0 and 10

user: 9

Too high!

Guess a number between 0 and 10

user:2

Too low!

Guess a number between 0 and 10

user: 5

You win!

The number must be randomly generated each game, the following function will yield a random number between 1 and 100000:

int randNum()

{

int i

time_t t1;

(void)time(&t1);

lrand48((long)t1); /*use time in seconds to set seed*/

return lrand48()/20000;

/*lrand48() returns non-negative long integers uniformly distributed over the interval (0~100000)*/

}

where libraries sys/types.h and time.h should be included.

requirments:

The game must include at least three difficulties(bonus: add a custom difficulty so the user can define the high number), should tell you how many guesses it took to get it, must use a loop, and a switch statement. The game must also look nice.

Reference no: EM13161144

Questions Cloud

Modify each sorting algorithm : Modify each sorting algorithm so that it keeps track of the number of comparisons it performs and the number of exchanges (swaps) it performs during a single sorting operation. Keep track of these numbers using two long integer counters
Compute the equilibrium pressure of n2o4 : calculate the equilibrium pressure of N2O4(g) and NO2(g). (c) What percentage (by moles) of the original N2O4(g) is dissociated at the new equilibrium position (total pressure = 1.00 atm)?
What would be the effect on co2 production : I'm looked everywhere including my text and I can't seem to figurething one out. If someone can please explain this so I have abetter understanding I would greatly appreciate it.
What is the fertilized egg cell called after the sperm : What is the fertilized egg cell called after the sperm enters it and it attaches to the tissue in the uterus?
Make a game in which you guess a number : Make a game in which you guess a number between two set numbers to find the answer, the game should tell you if you are too low in your guess or too high. For example
Write equations for the chemical reactions : write equations for the chemical reactions that occurred between the aqueous solutions of the oxides of sulfur and calcium and between the aqueous solutions
How often would an 8-base cutter cleave : The haploid genome contains about 3*10^9 nucleotides. On average, how many DNA fragments would be produced if this DNA was digested with restriction enzyme PstI (a 6-base cutter)? RsaI (a 4-base cutter?) How often would an 8-base cutter cleave?
State the reaction vessel feels cooler : The reaction vessel feels cooler. b.The value of K becomes smaller. c.The equilibrium will shift to the left. d.The reaction vessel feels warmer.
Given an array with 100,000 entries to sort : Sorting  given an array with 100,000 entries to sort. Under what circumstances would you use each of the following: insertion sort,mergesort'quicksort

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a program using vectors and iterators

Create a program that uses at least two functions that will be called from your main. This program is a number game program that asks for parts of your phone and after manipulating it mathematically, eventually outputs your entire phone number. The d..

  Write c program to add two integers and prints out average

Write a C program that prompts for a variable number of integers, adds them up, and prints out the average. The user will enter either an integer to be averaged.

  Computer programming techniques

Construct a program from a design and use appropriate functions

  Grocery store program

This program draws upon several concepts that were covered in CptS 121 and should serve as a good refresher for CptS 122. Our store, Cougar Mart, maintains its inventory in a text file. Not being very tech savvy, the owner of Cougar Mart needs you to..

  Prepare the weighted scoring model for three exams

Prepare the weighted scoring model. Final grades are based on three exams worth 15%, 20%, and 25%, respectively; homework is worth 20%.

  Writing function that computes leap years

Write down function that computes leap years. Function prototype is as follows: Write function body which returns true if year is a leap year and false if year is not a leap year.

  Returns a count of the steps through the sort

Please write a c++ implimentation that returns a count of the steps through the sort. (do not worry about updating count, I will rewrite that segemnt. I need help with writing the shell sort.

  Struct complex

A complex number can be represented by two parts, real and image. A series complex data can be organized as a group of elements by linked list, which is shown as below: struct Complex

  Create the appropriate constructor, getters and setters

Create the appropriate constructor, getters and setters for the class. Create an instance of Student for each of the students listed above from array. Construct the instance with lastname, firstname, and job.

  The user enter the total rainfall for each of 12 months

Write a program that lets the user enter the total rainfall for each of 12 months (starting with January) into an array of doubles. The program should calculate and display:the total rainfall for the year,the average monthly rainfall,and the months w..

  Write function that randomly produces maze

Write a function mazeGenerator that randomly produces a maze (in C++). The Function should take as arguments a two-dimensional 12-by-12 character array.

  Program to check compatibity for matrix multiplication

Write down program in C++ for matrix multiplication. Program must accept dimension of both matrices to be multiplied and check for compatibity.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd