#include<stdio.h>
#include<conio.h>
void main()
{
char ch;
clrscr();
printf("Enter a Character");
scanf("%c",&ch);
if(ch>=65 && ch<=90)
ch=ch+32;
printf("Upper Case =%c",ch);
getch();
}
You can write a function that does it.
For example:
for( i = 0; i < strlen(string); i++){
if(string[i] >= 'A' && string[i] <= 'Z'){
offset = string[i] - 'A';
string[i] = 'a' + offset;
}
}
#include <ctype.h>
void main()
{
char s[30],st[30];
cout<<"enter the string in uppercase\n";
cin.getline(s,30);
int i;
for(i=0;s[i]!='\0';i++)
{
st[i]=tolower(s[i]); // see discussion
}
//st[i]='\0'; // see discussion
cout<<st;
getch();
}
Look into the toupper() and tolower() functions. To determine what case it is in, you could use its ASCII value: uppercase is 65 (A) - 90 (Z) and lowercase is 97 - 122.
You can use macros 'isupper' and 'islower' (they are in 'ctype.h' too).
#include<stdio.h>
#include<conio.h>
void main()
{
char ch,lower;
printf("Enter a Character\n");
scanf("%c%c",&ch);
if(ch>=65 && ch<=90)
{
ch=ch+32;
printf("\nupper Case =%c",ch);
}
else if(ch>=97 && ch<=122)
{
ch=ch-32;
printf("\nlower Case =%c",ch);
}
getch();
}
#include<stdio.h> #include<conio.h> char foo(char a) { if(a>=97 && a<=122) { a = a - 32; return (a); } else { return (a); } } void main() { char a[20],b[20]; int i=0; clrscr(); printf("Please enter a string: "); gets(a); printf("The String in Lower Case is: "); do{ b[i]=foo(a[i]); i++; }while (a[i]!=0); while(i<=20) { b[i]=0; i++; } printf("%s",b); getch(); }
as i can do it by adding 32 to the ascii value to each character of given string..
for example:-
void f(char *s)
{
while(s[i]!='\0')
{
s[i]=s[i]+32;
}
}
Ggdd
This is not a question.
Yes
String library function is one which is used to perform an operation in C-programming,without which library functions likestrlen(),strcp(),strcmp(),strdup(),strrev(),etc..,.can be performed
It is somewhat syntax of programming. But when program runs,device known as pre-processor process statements before main function. So when we use that function inside main function it will get idea and run directly without showing any error. So for compilers simplicity and fast execution purpose it is necessary to declare function before its use.
You cannot. Conversion is one-way only. It is possible to convert machine code to disassembly, but disassembly is not high-level, it is simply a symbolic representation of the machine code, similar to assembly but without any constants, named variables or comments.
to convert AC into DC voltage without fluctuation
This is not a question.
Yes
You can use the UPPER function.
Without programming languages you couldn't write (system) programs.
Yes, multi-programming is possible without any interrupts. Provided that a given type of code is properly written then multi-programming is possible without any interrupts.
String library function is one which is used to perform an operation in C-programming,without which library functions likestrlen(),strcp(),strcmp(),strdup(),strrev(),etc..,.can be performed
It is somewhat syntax of programming. But when program runs,device known as pre-processor process statements before main function. So when we use that function inside main function it will get idea and run directly without showing any error. So for compilers simplicity and fast execution purpose it is necessary to declare function before its use.
You cannot. Conversion is one-way only. It is possible to convert machine code to disassembly, but disassembly is not high-level, it is simply a symbolic representation of the machine code, similar to assembly but without any constants, named variables or comments.
Without programming, computers would be expensive doorstops. Computer hardware requires computer software. Programming, even in machine code, is essential in creating that software.
Without programming, computers would be expensive doorstops. Computer hardware requires computer software. Programming, even in machine code, is essential in creating that software.
When writing a program, you write it in a certain language (java, C++, VB.NET etc.). For the computer to understand that, you need to convert it to computer language. That is what the compiler does.