Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

BASIC STRING PROGRAM You should write a program in C that has a string in it, and asks the user to guess the string. Your

BASIC STRING PROGRAM

You should write a program in C that has a string in it, and asks the user to guess the string.

Your program should tell the size of the string in the beginning. Pleas do not use a string containing more than 5 characters.

If the user guesses a correct character, your program should print the position of the correct character.

If the user cannot guess the correct string, your program should be terminated after 10 tries.

If the user guesses all the characters correctly, your program should show the word and be terminated.

Every thing should be in lower case.

The position your program shows starts at 1.

note: do not use malloc or alloc but you can use functions or arrays or strings

do not use struct keyword

please do not use strlen() function in string.h .

thankyou

sample output:

Example:

I have a word with the length of 4.

Try number: 1 -----------------

Guess a character in the word: p

No! Sorry about that. You can do better.

Try number: 2 ----------------

Guess a character in the word: l

Yay! You are super smart! You nailed it.

l is in position 1.

Try number: 3 ----------------

Guess a character in the word: o

Yay! You are super smart! You nailed it.

o is in position 2.

Try number: 4 ----------------

Guess a character in the word: v

Yay! You are super smart! You nailed it.

v is in position 2.

Try number: 5 ----------------

Guess a character in the word: e

Yay! You are super smart! You nailed it.

e is in position 4.

Wow!!! I cannot believe it. You just guessed the whole word:

love

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

2nd Edition

0471180742, 978-0471180746

More Books

Students also viewed these Databases questions