its simple in c and c++: mainly it depends on what type of answer ur looking track fro the user .. if its a numeric u can define a integer or float variable else a string variable to store characters . ex : printf("\n whats ur age ?"); scanf("%d",&age); printf("\n hey ur %d years old :",age); cout
print c co com comp compu
The use of the reverse string in C program is used to reverse the letters in the string. An example would be reverse me would be reversed to em esrever.
int main (void) { char buf[1024]; scanf ("Enter a string: %s", buf); printf ("The length of the string is %d chars long.\n", strlen (buf)); return 0; }
Any character can be used in string, except for \\0. char example [] = "A&B|C";
You do not need to program string manipulation as it is already part of the standard library. See std::string and std::wstring.
print c co com comp compu
#include<stdio.h> #include<conio.h> void main() { char string[20]; int i=0; printf("Enter the string.\n"); while(i<=19) { scanf("%c",&string[i]); i++; } while(i>=0) { printf("%c",string[i]); i--; } getch(); } In this program it is compulsory to enter 20 characters. Now we can write a program in which it is not necessary. #include<stdio.h> #include<conio.h> #include<string.h> void main() { char string[20]; int length; printf("enter the string.\n"); gets(string); length=strlen(string); length--; while(length>0) { printf("%c",string[length]); length--; } getch(); }
The use of the reverse string in C program is used to reverse the letters in the string. An example would be reverse me would be reversed to em esrever.
#include#includevoid main(){char a[30],b[30];clrscr();printf("Enter the string a:");gets(a);printf("Enter the string b:");gets(b);printf("%s",strcat(a,b));getch();}
int main (void) { char buf[1024]; scanf ("Enter a string: %s", buf); printf ("The length of the string is %d chars long.\n", strlen (buf)); return 0; }
Any character can be used in string, except for \\0. char example [] = "A&B|C";
strcpy
You do not need to program string manipulation as it is already part of the standard library. See std::string and std::wstring.
str[3]= 'A';
#include <iostream> #include <string> int main() { std::string myStr = ""; std::cout << std::endl << "Enter a string: "; std::cin >> myStr; system("PAUSE"); return 0; }
what is if(!(str[i]==32))
What type of a program is used in order to enter C source code