Jobs & Education0 min ago
Help With C Programms
2 Answers
Hello. I have c programming as a class and in order to pass it i need to send 2 programms until next week. The problem is i like biology and stuff and never tried to learn c programming can you help me?
First Program: Create a program in C programming language as the digital equivalent of the game guess the magic number.
The game generates a random integer using the rand () function and appropriately limits it to the range 1-300. The initialization of random production will be done with
the srand (Special student numper) function where special student numper is your personal number For example if the number is 9999 it will be called srand (9999).
The player has 8 attempts to find the magic integer that resulted from the previous procedure.
The program asks the user to enter his choice. If the number he enters is less than the magic number, the program informs him that the number he is looking for is
larger. On the contrary, if the number he enters is greater than the magic, he informs him that the number he is looking for is smaller.
When and if it finds the number, the further search stops and the program displays
to the user the message RIGHT !. On the contrary if it exceeds the 8 total available efforts
without locating the magic number the program displays FAILURE and is completed.
Second Program:Create a structured program in C programming language that will simulatethe operation of the simple calculator. The program will be used by young children to practice the four basic arithmetic operations, addition,subtraction, multiplication and division.
The program will run ten times, using a suitable loop and will select randomly in each iteration between four states using the srand (Special student numper) function where special student numper is your personal number For example if the number is 9999 it will be called srand (9999). Depending on its result it will call the corresponding function that will perform the arithmetic operation.So for result 0 it will call the function add (n1, n2) with arguments of two random integers n1 and n2 which range from 100 to 1000. The display will show the expression n1 + n2 = and the program will wait to read the user's answer. If the answer matches the integer return value of add (n1, n2) it will print "Right !!" otherwise "Error".For result 1 it will call the function sub (n1, n2) with arguments of two random integers n1 andn2 which range from 100 to 1000. But this time n1 will make sure it is greater than n2, if this does not happen to exchange their prices before calling sub The display will display the expression n1 - n2 = and the program will wait to read the user's answer. If the answer is the same as its integer return value sub (n1, n2) will print "Right !!" otherwise "Error".For result 2 it will call the function mult (n1, n2) with arguments of two random integers n1 and n2 which range from 1 to 30. The display will show the expression n1 X n2 = and the program will wait to read the user's response. If the answer is the same as the integer return value of mult (n1, n2) will print "Right !!" otherwise "Error".For result 3 he will call the function div (n1, n2) with arguments of two integers n1 and n2. n2 is random ranging from 1 to 20 while n1 is randomly determined again but results from the product of n2 with another random number m that also ranges from 1 to 20, ie n1 = m X n2 The display will show the expression n1: n2 = and the program will waiting to read the user's response. If the answer matches the integer value of div (n1, n2) it will print "Right !!" otherwise "Error".
functions we are allowes to use are printf, scanf, if, switch, for, while, do, rand, srand, puts, putchar.
I would like everyone who is willing to help
First Program: Create a program in C programming language as the digital equivalent of the game guess the magic number.
The game generates a random integer using the rand () function and appropriately limits it to the range 1-300. The initialization of random production will be done with
the srand (Special student numper) function where special student numper is your personal number For example if the number is 9999 it will be called srand (9999).
The player has 8 attempts to find the magic integer that resulted from the previous procedure.
The program asks the user to enter his choice. If the number he enters is less than the magic number, the program informs him that the number he is looking for is
larger. On the contrary, if the number he enters is greater than the magic, he informs him that the number he is looking for is smaller.
When and if it finds the number, the further search stops and the program displays
to the user the message RIGHT !. On the contrary if it exceeds the 8 total available efforts
without locating the magic number the program displays FAILURE and is completed.
Second Program:Create a structured program in C programming language that will simulatethe operation of the simple calculator. The program will be used by young children to practice the four basic arithmetic operations, addition,subtraction, multiplication and division.
The program will run ten times, using a suitable loop and will select randomly in each iteration between four states using the srand (Special student numper) function where special student numper is your personal number For example if the number is 9999 it will be called srand (9999). Depending on its result it will call the corresponding function that will perform the arithmetic operation.So for result 0 it will call the function add (n1, n2) with arguments of two random integers n1 and n2 which range from 100 to 1000. The display will show the expression n1 + n2 = and the program will wait to read the user's answer. If the answer matches the integer return value of add (n1, n2) it will print "Right !!" otherwise "Error".For result 1 it will call the function sub (n1, n2) with arguments of two random integers n1 andn2 which range from 100 to 1000. But this time n1 will make sure it is greater than n2, if this does not happen to exchange their prices before calling sub The display will display the expression n1 - n2 = and the program will wait to read the user's answer. If the answer is the same as its integer return value sub (n1, n2) will print "Right !!" otherwise "Error".For result 2 it will call the function mult (n1, n2) with arguments of two random integers n1 and n2 which range from 1 to 30. The display will show the expression n1 X n2 = and the program will wait to read the user's response. If the answer is the same as the integer return value of mult (n1, n2) will print "Right !!" otherwise "Error".For result 3 he will call the function div (n1, n2) with arguments of two integers n1 and n2. n2 is random ranging from 1 to 20 while n1 is randomly determined again but results from the product of n2 with another random number m that also ranges from 1 to 20, ie n1 = m X n2 The display will show the expression n1: n2 = and the program will waiting to read the user's response. If the answer matches the integer value of div (n1, n2) it will print "Right !!" otherwise "Error".
functions we are allowes to use are printf, scanf, if, switch, for, while, do, rand, srand, puts, putchar.
I would like everyone who is willing to help
Answers
Welcome to The AnswerBank. Unfortunatel y I don't think that we have many (if any) experts in programming among our regular contributors to this site at the moment. (It should be a very simple task to create suitable programs though, based upon my experience of programming in BASIC about 45 years ago!). Rather than leaving you without help though, I'll...
20:01 Sat 20th Nov 2021
Welcome to The AnswerBank.
Unfortunately I don't think that we have many (if any) experts in programming among our regular contributors to this site at the moment. (It should be a very simple task to create suitable programs though, based upon my experience of programming in BASIC about 45 years ago!).
Rather than leaving you without help though, I'll direct you towards the Stack Overflow site, where you should be able to find loads of people to help you. (Ignore the stuff about paid subscriptions. A free account is all that you'll need there):
https:/ /stacko verflow .com/
Unfortunately I don't think that we have many (if any) experts in programming among our regular contributors to this site at the moment. (It should be a very simple task to create suitable programs though, based upon my experience of programming in BASIC about 45 years ago!).
Rather than leaving you without help though, I'll direct you towards the Stack Overflow site, where you should be able to find loads of people to help you. (Ignore the stuff about paid subscriptions. A free account is all that you'll need there):
https:/
"I have C programming as a class"
"never tried to learn C programming"
It would seem that learning C programming might be a good place to start - what do you think?
How about this: Amazon.co.uk User Recommendation
"never tried to learn C programming"
It would seem that learning C programming might be a good place to start - what do you think?
How about this: Amazon.co.uk User Recommendation