Finding first/last occurrence of a character in a string
without using strchr( ) /strrchr( ) function.
Answer Posted / sepideh
#include<iostream>
#include<conio.h>
using namespace std;
int main(){
char m[20];
char x;
gets(m);
x=getch();
for(int i=0;i!=null;i++)
if(m[i]==x){
cout<<i;}
getch();}
Is This Answer Correct ? | 9 Yes | 0 No |
Post New Answer View All Answers
How do we print only part of a string in c?
Write a program to print "hello world" without using a semicolon?
FILE *fp1,*fp2; fp1=fopen("one","w") fp2=fopen("one","w") fputc('A',fp1) fputc('B',fp2) fclose(fp1) fclose(fp2)} a.error b. c. d.
How can a number be converted to a string?
Where are some collections of useful code fragments and examples?
Are c and c++ the same?
How do you print an address?
Is file a keyword in c?
What is integer constants?
Does c have function or method?
Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..
find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2
What is clrscr ()?
general for is %wd,f-d; in this system "w" means a) 'w' represent total width of digits b) 'w' represent width which includes the digits before,after decimal place and the decimal point c) 'w' represent width which includes the digits before only d) 'w' represent width after decimal place only
What does c mean?