Write a C program that reads your first and last names and then converts them to upper-case and lower-case letters. The results will be printed to standard output console.
- //Write a C program that reads your first and last names and then converts them to upper-case and lower-case letters. The results will be printed to standard output console.
- #include<string.h>
- #include<iostream>
- using namespace std;
- int main()
- {
- char c1[20],c2[20];
- int i;
- cin>>c1;
- cin>>c2;
- for(i=0;i<strlen(c1);i++)
- if(c1[i]>='a'&&c1[i]<='z')
- c1[i]=c1[i]-32;
- else
- if(c1[i]>='A'&&c1[i]<='Z')
- c1[i]=c1[i]+32;
- for(i=0;i<strlen(c2);i++)
- if(c2[i]>='a'&&c2[i]<='z')
- c2[i]=c2[i]-32;
- else
- if(c2[i]>='A'&&c2[i]<='Z')
- c2[i]=c2[i]+32;
- cout<<c1<<" "<<c2;
- }
Learn More :
Name
Upper Case
Convert
- C Program to Convert Text String to Binary
- C Program To Convert Decimal To Binary Using Recursion
- C Program To Convert Temperature In Celsius To Fahrenheit, Using Function
- C Program To Convert Temperature Into Celsius
- C Program to Convert Celsius to Fahrenheit temperature
- C Program to convert a string to upper case
- C Program Convert MIDI note to pitch
- C Program to Convert Celcius to Fahrenheit and vice versa
- C Program to Convert a Decimal number to Octal Number
- C Program to Convert Number to Words in C
- C Program to Converts a Number to a String.
- C Program to Convert Celsius Temperature into Fahrenheit Temperature
- C Program to Recursively converts all file-names to lower-case
- C Program to accept string from user & convert all lower case letters into upper case letters & vice versa
- C Program to convert given decimal number into binary number
- C Program To Read The Adjecancy Matrix of Directed Graph And Convert It Into Adjecancy List
Lower Case
Console
- C Program to Defines the entry point for the console application
- C program that receives 10 float numbers from the console and sort them in non-ascending order, and prints the result
- C Program to Defines the entry point for the console application
- Defines the entry point for the console application.
- File Handling (console to file) in C Program