#include <stdio.h>
void to_upper(char s[]) {
int i = 0;
while(s[i]) {
if(s[i] >= 'a' && s[i] <= 'z') {
s[i] -= 32;
}
i++;
}
}
int main()
{
char s[] = "hello";
printf("s = %s\n", s);
to_upper(s);
printf("s = %s\n", s);
return 0;
}


Question 4 5 Write a function to upper that converts a string from lower case to...
C++ 10.4 String to number Write a program that 1.reads in 4 upper case characters Converts each into its Ascii equivalent integer 3.Adds all these numbers together Converts this resulting integer to a string Prints the string. Divides the integer result by 4 Converts this back to an Ascii char prints the char
Write a new subroutine in assembly to convert the upper-case letters to lower-case letter. Example of lower case to upper is provided below: Let’s look at a subroutine to capitalize all the lower-case letters in the string. We need to load each character, check to see if it is a letter, and if so, capitalize it. Each character in the string is represented with its ASCII code. For example, ‘A’ is represented with a 65 (0x41), ‘B’ with 66 (0x42),...
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...
The program needs to be written in C. Write a function void camelCase(char* word) where word consists of more than two words separated by underscore such as “random_word” or "hello_world_my_name_is_sam". camelCase() should remove underscores from the sentence and rewrite in lower camel case” (https:// en.wikipedia.org/wiki/Camel_case). Watch out for the end of the string, which is denoted by ‘\0’. You have to ensure that legal strings are given to the camelCase() function. The program should only run when the input is...
10. replaceSubstring Function Write a function named replaceSubstring. The function should accept three C-string or string object arguments. Let's call them string1, string2, and string3. It should search string for all occurrences of string2. When it finds an occurrence of Programming Challenges string2, it should replace it with string. For example, suppose the three arguments have the following values: stringt: "the dog jumped over the fence" string 2 "the" string3: "that" With these three arguments, the function would return a...
Write a C or C++ program A6p1.c[pp] that accepts two command line arguments n and m where n is an integer between 2 and 6 inclusive and m can be assumed to be a multiple of 60 (e.g. 60,120,etc). Generate a string of m random upper case English characters and store them somewhere (e.g. in a char array). Use pthread to create n threads to convert the string of m chars in place into an off-by-one lower case version (i.e. ‘A’→’b’, ‘B’→’c’, ‘C’→’d’,…, ‘Y’→’z’, ‘Z’→’a’). You should divide this conversion task among the n threads as evenly as possible. Print out the string both...
Question- How would I allow the program to run both upper and lower case letters. How would I write a switch statement for upper and lower cases to see if the value entered for Grade2 is a A or a? C programming int main() { char Grade2; float gradepoint; char Grade = 'X'; // Declares a character type variable named Grade printf("Enter a grade\t"); // Prompts for Grade scanf("%c", &Grade); // Inputs Grade printf("Grade is: \t%c\n", Grade); // Prints the...
Write a Java program which takes a string as a user input. Create 2 functions. The first function expects a string as argument and returns void. It converts all upper case characters to lower case and converts all lower case characters to upper case. It then prints out the converted string to a console. The second function also expects a string as argument and returns void. It will find first charactor that is repeated exactly 2 times in the string....
pUI) FOU are to write a function which has a prototype: void count (char sl, int *pUpper, "pLower, "poigit, pother) s [ is a character string which may be of any length. Other arguments are address of where the number of upper, lower, digits, and other characters in the string should be placed. For example (this is only an example) the code (put into a properly written program): char all "12145-9ABD, 3f0 :bbB2" char bll "148x3!!" char c[] = {...
Create a UNIX makefile for the following C
program:
//convert.c
char toUpper(char c){
if(c>='a' && c<='z')
return c-32;
return c;
}
//converting sentance to upper
void convertSentence(char *sentence){
int i=0;
while(sentence[i]!='\0'){
//convert to upper for each character
sentence[i] = toUpper(sentence[i]);
i++;
}
}
//converting all sentences into uppercase
void convertAll(char **sentenceList, int numOfSentences){
int i=0;
while(i<numOfSentences){
//calling convertsentence function to conver uppercase
convertSentence(sentenceList[i]);
i++;
}
}
sentences.c
#include<stdio.h>
#include<stdlib.h>
#include "convert.c"
int main(){
//declaring character array
char **mySentences;
int noOfSentences;...