Question

***C Programming, Create program that can ask users to input a wird of text. Then convert...

***C Programming, Create program that can ask users to input a wird of text. Then convert the user's text to uppercase. Users may lowercase or uppercase letters. use Strings to comoute these tasks... 'x'+1='y'

Homework Answers

Answer #1

Assumptions:
1. The user inputs from command line
2. The output shown in command line

#include <stdio.h>
#include <string.h>
int main() {
char txt[100];
int i;
//Enter the Text
printf("\nEnter a string : ");
//Reading String
fgets(txt, sizeof(txt), stdin);
//Looping String
while (txt[i]) {
//converting alphabets to Uppercase
if(txt[i] >= 'a' && txt[i] <= 'z') {
txt[i] = txt[i] - 32;
}
i++;
}
//Prints the output
printf("\nString in Upper Case: ");
puts(txt);
return 0;
}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Programming Challenge B write a simple program that takes as input 2 16-bit strings of 0's...
Programming Challenge B write a simple program that takes as input 2 16-bit strings of 0's and 1's. (For example one string is assigned X and on string is assigned Y). Compute and and display the bitwise AND, bitwise OR, and bitwise XOR of the two string, (For example, the resultant string is Z). You may use the programming language of your choice. Alternatively, if you do not know a programming language, you may describe your algorithm in plain text...
c# please Create a “Main” program which reads a text file called “collectionOfWords.txt”. Include exception handling...
c# please Create a “Main” program which reads a text file called “collectionOfWords.txt”. Include exception handling to check if the file exists before attempting to open it. Read and print each string to the console. Next modify each word such at the first letter in each word is uppercase and all other letters are lowercase. Display the modified word on the console. Creating a text file: Open up Notepad and type in the following words. Save the file as collectionOfWords.txt...
Write a Python program to ask how many elements do users want to create in a...
Write a Python program to ask how many elements do users want to create in a list, then let the user create 2 lists with the number of elements previously entered. Then create and display all combinations of letters, selecting each letter from a different key in a dictionary. Example: How many elements? 2 List 1 = ['a', 'b'] List 2 = ['c', 'd'] Output: ac ad bc bd
I need python code for this. Write a program that inputs a text file. The program...
I need python code for this. Write a program that inputs a text file. The program should print the unique words in the file in alphabetical order. Uppercase words should take precedence over lowercase words. For example, 'Z' comes before 'a'. The input file can contain one or more sentences, or be a multiline list of words. An example input file is shown below: example.txt the quick brown fox jumps over the lazy dog An example of the program's output...
use php only User can input ant value in text format Users have no restriction on...
use php only User can input ant value in text format Users have no restriction on the number of order items they can. The program outputs the data type: String Integer Boolean Decimal NULL Requirements 1. You may not use an array 2. You may not use any 'is_' functions for checking null, bool, integer, decimal or string types. 3. You may not use regular expressions. 4. If the user enters 'null' the value should be null. 5. If the...
Write a Python program to ask user input of a string, then ask user input of...
Write a Python program to ask user input of a string, then ask user input of what letters they want to remove from the string. User can either put in "odd", "even" or a number "n" that is greater than 2. When user input "odd", it will remove the characters which have odd numbers in the sequence of the string. When user input "even", it will remove the characters which have even numbers in the sequence of the string. When...
R-S-P Requirement: - write one C++ program that mimics the Rock-Scissor-Paper game. This program will ask...
R-S-P Requirement: - write one C++ program that mimics the Rock-Scissor-Paper game. This program will ask user to enter an input (out of R-S-P), and the computer will randomly pick one and print out the result (user wins / computer wins). - User's input along with computer's random pick will be encoded in the following format: -- user's rock: 10 -- user's scissor:          20 -- user's paper:            30 -- comp's rock:            1 -- comp's scissor:        2 -- comp's...
Write a python program that will perform text analysis on an input text using all of...
Write a python program that will perform text analysis on an input text using all of the following steps: 1. Take the name of an input file as a command line argument. For example, your program might be called using python3 freq.py example1 to direct you to process a plain text file called example. More information is given on how to do this below. 2. Read the contents of the file into your program and divide the text into a...
Assignment 2 Create a Java program called UserNames that reads the user's first and last name...
Assignment 2 Create a Java program called UserNames that reads the user's first and last name (separately), then prints a string composed of the first 4 letters of the user's last name, followed by the first letter of the user's first name, followed by a random number in the range of 10 to 99 (inclusive). You can assume the first name is at least one letter long and the last name is at least 4 letters. After doing this once,...
Description: Programming can be used to assist users in completing complex calculations very quickly. As seen...
Description: Programming can be used to assist users in completing complex calculations very quickly. As seen in class practices, we were able to calculate the area of geometric shapes, figure out the amount of calories in cookies, and even calculate a restaurant bill. For this assignment, you will take input from the user to provide interactive messages and to solve the following word problem: Engineers often need to convert between different types of units to perform calculations that follow standard...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT