UGRENT!! WHAT TO DO IS MENTIONED IN THE COMMENTS
The functions are easy but since I'm new to C language, I'm struggling with it.
Please help me out with correct answers!!!
#include <stdio.h>
char random_letter();
/***************** FIX THE 5 FUNCTIONS BELOW ************************/
/*
* IMPORTANT!!!
* The only functions you may call are printf and random_letter
*/
/*
* Returns 1 if i is negative and 0 otherwise
*/
int is_negative(int i) {
return 0;
}
/*
* Returns the maximum value out of a, b, and c
*/
int max(int a, int b, int c) {
return a;
}
/*
* Prints a random letter to the screen.
* You need to fix this one.
* Assume random_letter returns a random letter
*/
void print_random_letter() {
char c = random_letter();
printf("%d\n", c);
}
/*
* Returns the number of times the number 10 appears in the
* array A that that has size slots.
*/
int count_tens(int A[], int size) {
if (A[0] == 10)
return 1;
else
return 0;
}
void capitalize_e(char s[]) {
/* Modifies s so that all occurrences of 'e'
* are replaced with 'E'.
*/
}
#include <stdio.h>
char random_letter();
/***************** FIX THE 5 FUNCTIONS BELOW ************************/
/*
* IMPORTANT!!!
* The only functions you may call are printf and random_letter
*/
/*
* Returns 1 if i is negative and 0 otherwise
*/
int is_negative(int i) {
return (i < 0);
}
/*
* Returns the maximum value out of a, b, and c
*/
int max(int a, int b, int c) {
return (a > b) ? ((a > c) ? a : c) : ((b > c) ? b : c);
}
/*
* Prints a random letter to the screen.
* You need to fix this one.
* Assume random_letter returns a random letter
*/
void print_random_letter() {
char c = random_letter();
printf("%c\n", c);
}
/*
* Returns the number of times the number 10 appears in the
* array A that that has size slots.
*/
int count_tens(int A[], int size) {
int i;
int count = 0;
for(i=0; i<size; i++) {
if (A[i] == 10)
count++;
}
return count;
}
void capitalize_e(char s[]) {
/* Modifies s so that all occurrences of 'e'
* are replaced with 'E'.
*/
int i=0;
while(s[i] != '\0') {
if(s[i] == 'e') {
s[i] = 'E';
}
i++;
}
}
Please upvote, as i have given the exact answer as asked in question. Still in case of any concerns in code, let me know in comments. Thanks!
UGRENT!! WHAT TO DO IS MENTIONED IN THE COMMENTS The functions are easy but since I'm...
Missing multiple labeled functions. Card matching game in C. Shouldn't need any more functions. I am lost on how to complete the main function (play_card_match) without the sub functions complete. The program runs fine as is, but does not actually have a working turn system. It should display question marks on unflipped cards when the player is taking a turn and should also clear the screen so the player can't scroll up to cheat. Thank you #include "cardMatch.h" //main function /*...
Write C programs named mystring.h and mystring.c, containing the headers and implementations of the following functions. int letter_count(char *s) computes and returns the number of English letters in string s. int word_count(char *s) computes and returns the number of words in string s. void lower_case(char *s) changes upper case to lower case of string s. void trim(char *s) removes the unnecessary empty spaces of string s. mystring.h #include <stdio.h> int letter_count(char *); void lower_case(char *); int word_count(char *); void trim(char...
In C programming Write the implementation for the three functions described below. The functions are called from the provided main function. You may need to define additional “helper” functions to solve the problem efficiently. Write a print_string function that prints the characters in a string to screen on- by-one. Write a is_identical function that compares if two strings are identical. The functions is required to be case insensitive. Return 0 if the two strings are not identical and 1 if...
I'm having trouble getting my program to output What is your first name? damion what is your last name? anderson damion, Your first name is 6 characters Your last name, anderson, is 8 characters Your name in reverse is: noimad nosredna This is my code so far: #include <stdlib.h> #include <stdio.h> void sizeOfName(char** name); void printSizeOfName(int *first, int *last, char** name); void reverseString(int *first, int *last, char** name); int main() { char** name; name = (char**)malloc(2*sizeof(char*)); name[0] = (char*)malloc(100*sizeof(char)); name[1]...
I'm writing code for a poker game and I'm not sure where I'm going wrong with it. My compiler is sending back errors for lines (typedef int bool)(the two char* declarations) and the two functions before my if else statement (approx lines 109). #include <stdio.h> #include <stdlib.h> #include <time.h> #define SUITS 4 #define FACES 13 #define AVAILABLE 0 #define TAKEN 1 #define SIZE 5 #define TRUE 1 #define FALSE 0 void dealACard(char *suits[], char *faces[], int deck[][FACES]); void dealAHand(char *suits[],...
Question: Please Provide Comments on each Line of code explaining what the C Function is doing throughout the code. // Function used for substitution encryption void SubEncrypt(char *message, char *encryptKey) { int iteration = 0; printf("Enter Aphabet Encryption Key: \n"); scanf("%s", encryptKey); for (iteration = 0; iteration < strlen(message); iteration++) { char letter = message[iteration]; if (letter >= 'A' && letter <= 'Z') { letter = encryptKey[letter - 'A']; } message[iteration] = letter; } printf("CipherText message: %s\n", message); } //_________________________________________________________________________________________________________________________________________________...
USE C programming (pls label which file is libcipher.h and libcipher.c) Q4) A shift cipher is one of the simplest encryption techniques in the field of cryptography. It is a cipher in which each letter in a plain text message is replaced by a letter some fixed number of positions up the alphabet (i.e., by right shifting the alphabetic characters in the plain text message). For example, with a right shift of 2, ’A’ is replaced by ’C’, ’B’ is...
Could someone please help me with this C language code I'm confused as to why i'm getting an error every time I run it on command line if some could please help me as soon as possible. #include <stdio.h> #include <stdlib.h> int main() { char *ptr_two = (char *)malloc(sizeof(char)*50); printf("%p\n", ptr_two); ptr_two = "A constant string in C"; printf("%p\n", ptr_two); printf("%s\n", ptr_two); free(ptr_two); return 0; }
Please Complete the following C Code with Comments explaining your solution and post a screenshot of it working. Summary: This project explores pattern matching techniques to find a pattern in a DNA sequence containing letters in the DNA alphabet {A, C, G, T}. For example, suppose we have a DNA sequence as follows: ATGACGATCTACGTATGGCAGCCACGCTTTTGATGTTAAGTCACACAGCCAAGTCA ACAAGGGCGACTTCATGATCTTTCCGCTCCGTTGGTGTAGGCCCGTGTTCAAATTC AATGGCTGATTGGAATTACCTTTGAAATACTCCAACCGACCGCCACGGCCAGGGT CCCGCTCGCTCTCTGTGGCCCTCCCACAAAACTCCGGTGAAAGTTGATTTGGACAC GGACCCAAAGCAGCGTAGATTATTCGAGCGTATTCGGTAGTCATTGAGGCCCCAA The pattern “AATGG” can be found at the beginning of the third line. Note that overlapping matches are counted individually. For example,...
Write a C program that does the following: Displays a menu (similar to what you see in a Bank ATM machine) that prompts the user to enter a single character S or D or Q and then prints a shape of Square,Diamond (with selected height and selected symbol), or Quits if user entered Q.Apart from these 2 other shapes, add a new shape of your choice for any related character. Program then prompts the user to enter a number and...