Questions
#include <stdlib.h> #include <stdio.h> #include <string.h> void clrScreen(int lines){     int i = 0;     for( i =...

#include <stdlib.h>

#include <stdio.h>

#include <string.h>

void clrScreen(int lines){

    int i = 0;

    for( i = 0; i < lines; ++i ){

        printf("\n");

    }

    return;

}

void printRules(void){

    printf("\t|*~*~*~*~*~*~*~*~*~ How to Play ~*~*~*~*~*~*~*~*~*~|\n");

    printf("\t|   This is a 2 player game. Player 1 enters the   |\n");

    printf("\t|   word player 2 has to guess. Player 2 gets a    |\n");

    printf("\t|   number of guesses equal to twice the number    |\n");

    printf("\t|   of characters. EX: If the word is 'example'    |\n");

    printf("\t|   player 2 gets 14 guesses.                      |\n");

    printf("\t|*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~|\n");

    clrScreen(10);

    return;

}

//------------------------------------------------------------------------------------------------------------

/* /\DO NOT MODIFY ABOVE THIS LINE /\*/

void playGame(){

int correctGuess = 1;

    char garbage;

clrScreen(40);

    printRules();

    printf("Player 1: Enter a word smaller than 50 characters: ");

    clrScreen(40);

    if( -1 == correctGuess ){

        printf("CoNgRaTuLaTiOnS!!!!!! You figured out the word!!!\n");

        printf("\t\t%s\n");

    } else {

        printf("You didn't figure out the word.....it was %s\n");

        printf("Better luck next time!\n");

    }

    printf("Press 'enter' to continue to main menu.\n");

    scanf("%c", &garbage);

}

int menu(void){

    int loop = 1;

    while( loop ){

        clrScreen(40);

        printf("*~*~*~*~*~*~*~*~*~*~Welcome to Hangman!*~*~*~*~*~*~*~*~*~*~\n");

        printf("\t1.) Play the game\n");

        printf("\t2.) Quit\n");

        printf("Please make a selection: ");

    }

}

/*

    hangman game RULES:

    2 player game

        player 1

            enter a word for player 2 to guess

            enter a number of guesses player 2 gets to have. It must be at least 2x as big

                as the number of letters in the word.

            For example, if you enter the word 'sky' you must give the player at least 6 guesses.

        player 2

            try to guess the word player 1 has entered.

            you get X number of guesses

*/

int main(void){

    return 0;

}

//In c programming language

//please help me finish this hangman program. Thank you.

In: Computer Science

java: Sample output: Aoccdrnig to reacresh at an Elingsh uinervtisy, it deos not mttaer in waht...

java:

Sample output: Aoccdrnig to reacresh at an Elingsh uinervtisy, it deos not mttaer in waht oredr the ltteers in a wrod are, the olny iprmoetnt tihng is taht the frist and lsat ltteer are in the rghit pclae. The rset can be a toatl mses and you can sitll raed it wouthit a porbelm. Tihs is bcuseae we do not raed ervey lteter by it slef but the wrod as a wlohe and the biran fguiers it out aynawy.

PROGRAM DESCRIPTION: In this assignment, you will read an unspecified number of lines of text from STDIN. Input is terminated with EOF (ctrl-d for keyboard input). Your only output, to STDOUT, will echo the input except that the letters of any word with more than three characters will be randomly shuffled (except for the first and last letters). Don't scramble any punctuation, and you may assume that punctuation will only occur at the end of a word. Any word will have, at most, one punctuation character. Punctuation does not count towards the length of the word. You may also assume that each word will be separated by one space and that a line will have no leading or trailing whitespace. Blank lines are allowable. You must preserve the newlines (output must have the same number of lines and the same number of words on each line as when input.) (A word, here, is defined as a sequence of alphanumeric characters delimeted by whitespace.) For this assignment you must code the shuffle algorithm as described in class, and not a library shuffle function.

Sample input:According to research at an English university, it does not matter in what order the letters in a word are, the only important thing is that the first and last letter are in the right place. The rest can be a total mess and you can still read it without a problem. This is because we do not read every letter by itself but the word as a whole and the brain figures it out anyway.

Sample run:

This is a test
This is a tset
Hello, how are you today?
Hlleo, how are you toady?

SUGGESTIONS

You may find it easiest to complete this program in stages. Begin by writing a program that echos input lines of text to output. Then add the ability (a function) to break a line of text into individual words, finally add the scrambling feature (another function) for a word.

In: Computer Science

Draft a project scope statement for the TIMS system and describe the constraints. Please be specific....

Draft a project scope statement for the TIMS system and describe the constraints. Please be specific.

  • Use Microsoft Office Word to write your project scope statement.
  • Submit the Microsoft Office Word document in this drop box as an attachment

In: Operations Management

Discuss one of the theories of development during middle childhood. (PLEASE DO NOT COPY WORD FROM...

Discuss one of the theories of development during middle childhood.

(PLEASE DO NOT COPY WORD FROM WORD FROM A SOURCE!!!! ALSO PLEASE GIVE REFERENCES FROM WEBSITES OR ANY OTHER SOURCES PLEASE!!! THANK YOU!!)

In: Psychology

Write a Python program that reads a file, input by the user, containing one word/token per...

Write a Python program that reads a file, input by the user, containing one word/token per line with an empty line between sentences. The program prints out the longest word found in the file along with its length.

In: Computer Science

In this program, you will generate a random “sentence” constructed of random “words”. Quotes are used...

In this program, you will generate a random “sentence” constructed of random “words”. Quotes are used in the preceding sentence because the “words” will mostly be nonsense words that do not exist in the English language.

Step 1. The average number of words in an English sentence is about 17 words. First generate a pseudorandom number NW between 10 and 20 for the number of words in your random “sentence”. Use srand( ) to set the initial value in the iterative algorithm within the rand( ) function. Given NW, initialize a for-loop for(i=0; i

Step 2. To generate a pseudorandom “word” within the for-loop above, you first need to generate a pseudorandom number NL for the number of letters in the “word”.
The number of letters in a word follows the following probability table. two-letter words 0.20 three-letter words 0.27 four-letter words 0.22 five-letter words 0.14 six-letter words 0.09 seven-letter words 0.08 -------------------------------- Total = 1.00
Think of generating a pseudorandom value NL between 0.0 and 1.0 and choosing the number of letters in the “word” using the pseudorandom value according to the following: If NL >= (0.00) and NL <= (0.20), then the number of letters in the word will be two. If NL> (0.20) and NL <= (0.20+0.27), then the number of letters in the word will be three. If NL> (0.20+0.27) and NL <= (0.20+0.27+0.22), then the number of letters in the word will be four. If NL> (0.20+0.27+0.22) and NL <= (0.20+0.27+0.22+0.14), then the number of letters in the word will be five. If NL> (0.20+0.27+0.22+0.14) and NL <= (0.20+0.27+0.22+0.14+0.09), then the number of letters in the word will be six.
If NL> (0.20+0.27+0.22+0.14+0.09) and NL <= (0.20+0.27+0.22+0.14+0.09+0.08), then the number of letters in the word will be seven.
Notice that there are 6 intervals, representing NL=2 to NL=7. To assign a number of letters NL in the “word”, declare a 6-cell 1-D float array prob_letters[ ] and load the 1-D array with the probability sums from above. float prob_interval[6]={ 0.2, 0.47, 0.69, 0.83, 0.92, 1.0};
Now generate a pseudorandom value x between 0.0 and 1.0 x=rand( )/(float)RAND_MAX; Initialize the number of letters NL to 2: NL=2; Now check if x lies in one of the other five intervals for NL=3 to NL=7. If so, assign NL to the number of letters for that interval. for(i=1; i<6; i++){ if(x>= prob_interval[i-1] && x<= prob_interval[i])NL=i+2; }
Two important Notes : Important Note 1 : A better way to generate the 1-D array of interval values prob_interval[ ] is to start from the probabilities for the occurrencess of NL=2 through NL=7. float prob_interval[6]={ 0.2, 0.27, 0.22, 0.14, 0.09, 0.08}; Then form the array elements as the sums for(i=1; i<6; i++){ prob_interval[i]= prob_interval[i]+ prob_interval[i-1]; } Use this approach in the

Step 3 below. Important Note 2. : The array prob_interval[ ] should be generated only one time, before you begin any looping. Do not generate this array over-and-over-again, by incorrectly placing it inside the loop in Step 1. Step 3. Print out a “word” of length NL letters to the display. This “word” will be constructed from pseudorandom letters a-z. Start with a for-loop for(j=0; j a 0.085 b 0.021 c 0.045 d 0.034 e 0.112 f 0.018 g 0.025 h 0.030 i 0.075 j 0.002 k 0.011 l 0.055 m 0.030 n 0.067 o 0.07 p 0.032 q 0.002 r 0.076 s 0.057 t 0.070 u 0.036 v 0.011 w 0.013 x 0.002 y 0.018 z 0.002 ---------------- total 1.000
Use the method from Step 2. You can make use of the sequential ascii character codes for letters ‘a’ through ‘z’. float prob_let[26]= {0.085, 0.021, 0.045, 0.034, 0.112, 0.018, 0.025, 0.030, 0.075, 0.002, 0.011, 0.055, 0.030, 0.067, 0.071, 0.032, 0.002, 0.076, 0.057, 0.070, 0.036, 0.011, 0.013, 0.002, 0.018, 0.002}; Important Note: The first letter of the first word in the sentence should be printed as capitalized; i.e. uppercase. Step 4. Place a blank space after the “word” printed in Step 3, or place a period after the “word” printed in Step 3 if it is the last “word” in the sentence. Your results should look like: Elfh gfk llae mjlodp noc tjvjs mlknko si. Note, we haven’t applied any rules such as: 1. a “minimum of one vowel per word”; 2. ‘t’ is often followed by ‘h to form ‘th’; 3. ‘s’ often occurs at the end of a word to form a plural; 4. etc.. so actual words will only appear infrequently

In: Computer Science

Briefly discuss some of the indicators of an outdated costing system (Word limit: 200 words) b)...

Briefly discuss some of the indicators of an outdated costing system (Word limit: 200 words) b) Despite the obvious advantages of ABC, many firms are still reluctant to implement it. What are the reasons for this reluctance? (Word limit: 150 words)

In: Accounting

Using a text editor, create a file english.txt containing the following words: yes no go come...

Using a text editor, create a file english.txt containing the following 
    words:
    
    yes no go come thanks goodbye
    
    Create a second file chinese.txt contain the following words:
    
    shi bu qu lai xiexie zaijian
    
    Write a program that reads the words from english.txt so that
    the successive slots of a char * array english point to them. 
    Use the %s conversion code in a fscanf call to read one word
    at a time.
             
    Similarly, read the words from chinese.txt so that the 
    successive slots of a char * array chinese point to them.
    
    Your program should then execute a loop that prompts the user 
    for an English word, reads it in (use scanf), and then 
    displays the corresponding Chinese word. The loop should 
    continue until the user enters the word "done". 

In: Computer Science

This problem is adapted from an earlier edition of P&H. Consider the following code used to...

This problem is adapted from an earlier edition of P&H.

Consider the following code used to implement the instruction: foo $s0,$s1,$s2

mask: .word 0xFFFFF83F

start: la $t0,mask

lw $t0,0($t0)

la $s0,shftr

lw $s0,0($s0)

and $s0,$s0,$t0

andi $s2,$s2,0x1f

sll $s2,$s2,6

or $s0,$s0,$s2

la $t5,shftr

sw $s0,0($t5)

shftr: sll $s0,$s1,0

Add meaningful comments to the code. Please explain each line and write a paragraph describing how it works. Why do you suppose that writing “self-modifying code” such as this is a bad idea (and often times not actually allowed)?

Please explain it. thank you.

Note: We have not covered the .word directive yet. This is an assembler directive, which is essentially an instruction to the assembler (NOT an assembly language instruction). In this case, it tells the assembler to reserve a word of memory initialized to 0xfffff83f. Mask is the address of this word (just as start is the address of the word in memory containing the machine code for that lw instruction).

In: Computer Science

What does the word hygiene mean

What does the word hygiene mean

In: Operations Management