Home Answers Viewqa Java-Beginners help with substring in c programing

 
 


nazi nazanin
help with substring in c programing
2 Answer(s)      2 years and 2 months ago
Posted in : Java Beginners

Hi I could not found programming in C in the "select category" so I am posting my question in java section. Please help with substring function,prompt the user for two strings and display whether or not the second string is a substring of the first string.

Regards

View Answers

March 10, 2011 at 5:25 PM


#include<stdio.h>
#include<conio.h>

void main()
{
char str[80],sub[10];    
int count1=0,count2=0,i,j,flag;

clrscr();

puts("Enter a string:");
gets(str);

puts("Enter search substring:");
gets(sub);

while (str[count1]!='\0')
count1++;

while (sub[count2]!='\0')
count2++;

for(i=0;i<=count1-count2;i++)
{
for(j=i;j<i+count2;j++)
{
flag=1;
if (str[j]!=sub[j-i])
{
flag=0;
break;
}
}
if (flag==1)
break;
}
if (flag==1)
puts("Substring is found!");
else
puts("Substring does not found!");
getch();
}

March 11, 2011 at 2:13 AM


thank you for your help, but when I run the program in eclipse, I get the error message " implicit declaration of function clrscr().









Related Pages:
help with substring in c programing
help with substring in c programing  Hi I could not found programming in C in the "select category" so I am posting my question in java section. Please help with substring function,prompt the user for two strings and display
C Programming SubString Program
C Programming SubString Program  Sir I want to Check whether the Single Substring is present in the given 3 string. characters. eg if i entered... will be TRUE. Plz Help Me
programing
Hello if anyone can help I would like to know why I get this error when executing
C++ programing
C++ programing  how to change constants to be randomly generated
c programing
c programing  Write 2 implementations of C's string copy routine, one with a loop and the other using recursion. What is the security risk with this routine? The function should have the signature: char* strcpy(char* destination
c programing
c programing  Write 2 implementations of C's string copy routine, one with a loop and the other using recursion. What is the security risk with this routine? The function should have the signature: char* strcpy(char* destination
Programing Help - Java Beginners
Programing Help  how to design a filebrowser in java "witout using Swing
SubString help - Java Beginners
SubString help  Hi , I would appreciate if somebody could help me... a substring of 35 zeros '00000000000000000000000000000000000' and they could... substring . If it find 35 zeros i need 10 digits in front of it along with those
Substring in java
Substring in java   example:output 0f the code.. Input String:University of the Cordilleras Input Substring:of Output:1 ...use non static methods,don't use (.Substring).. ..please help me.. ..thank you.. deadline:November
Substring in java
Substring in java   example:output 0f the code.. Input String:University of the Cordilleras Input Substring:of Output:1 ...use non static methods,don't use (.Substring).. ..please help me.. ..thank you.. deadline:November
Java programing help
Java programing help  Can you help me create this program? Write a console program that repeatedly prompts the user to enter data until they type done (any case, Upper, Lower, or Mixed). As they enter the data, assign
C Programing - CVS
C Programing  Write a C Program to display the following menu: Menu 1. Display 2. Copy 3. Append 4. Exit Accept the choice (1-4) from the user, and perform the following tasks: Choice 1: Accept a file name from the user
Java programing
Java programing   need help wrting this Write a program that has an array of 5 Strings, and determines which ones are palindromes (letter-case does not matter). thanks
C String Substring
C String Substring       In this section, you will learn how to get the substring from a string in C. You can see in the given example, a string and a method substring
programing question
programing question  how do i use loops(for,while) to add components in java   Hi Friend, The below code might help you. import java.awt.*; import javax.swing.*; class TextFieldArray extends JFrame{ JLabel l[]=new
guys,, need help,, in java programing,, arrays
guys,, need help,, in java programing,, arrays  create a program where you will input 10 numbers and arrange it in ascending way using arrays
programing - IoC
programing  write 4 integers . in that print smalest integer and largest integer  Hi friend, Code to help in solving the problem : import java.io.*; class NumberExample { public static void main(String[] args
programing - WebSevices
programing  write a program that ask the user to input 4 integers. the program print the smallest and biggest number. the folowing is the sample out put  Hi friend, Code to help in solving the problem : import
remove a substring from a string
remove a substring from a string  Please I jave an arraylist composed as follwoing [w1, w2, w3, w4, w1.w2.w3, w2.w3.w4, w3.w4, w2.w4, w1.w3, w1.w2... of w1.w2.w3 ?how I recognize it same for w1.w2 in w1.w2.w3. I nedd your help
check if a substring exists in a string
check if a substring exists in a string  Please I jave an arraylist composed as follwoing [w1, w2, w3, w4, w1.w2.w3, w2.w3.w4, w3.w4, w2.w4, w1.w3... your help. Thanks a lot
SOCKET PROGRAMING IN THE JAVA FOR NETWORKING CONCEPT
SOCKET PROGRAMING IN THE JAVA FOR NETWORKING CONCEPT  I WANT TO KNOW ABOUT THE JAVA SOCKET PROGRAMING FROM BASIC LEVEL AND HOW CAN I WORK ON IT I KNOW THE JAVA PROGRAMING.SO PLEASE HELP ME HOW CAN I DO SOCKET PROGRAMING
C get Substring from String
C get Substring from String       This section illustrates you how to get the substring using library function. You can see in the given example, we have used the library
C++
C++  I have been asked to write a programme that gets five values,gets the sum,average and product please help me
beginning java programing
help me. public void findAndAddFlavor() { //Retrieve the new flavor
Java Programing - Java Beginners
= new JMenuItem("Copy"); copyMenuItem.setMnemonic('c
String substring(int beginIndex)
String substring(int beginIndex)   ... the substring(int beginIndex) method of String class. We are going to use substring(int beginIndex) method of String class in Java. The description of the code
java programing - Java Beginners
java programing  hi!! I Wish i am welcome in this site. As You can see i am trying to teach my self how to program using java language and manually is by not using the function in java language. please help me   
java programing - Java Beginners
;> I need your help about this...   Hi Medinz, Here is my
c programming
c programming  write a program to input five numbers by using while loop in c programing
C Help - Development process
C Help  Dear sir, I'm developing a program in c using TURBO-C, i want that when my program runs the console window(cmd) should be hidden. program should run in task manager. thnx
C Program....PLEASE HELP
C Program....PLEASE HELP  For this assignment, you are to write a program that calculates points along a rhodonea curve, a.k.a. a mathematical rose..., and pointers. I am lost and need a little help starting please *int fillArray
Need urgent help with C++ errors!
Need urgent help with C++ errors!  hi, i'm new to C++ programming. this is my code... i'm using Turbo C++. It's showing so many errors!.. I don't know what to do. Please help!! #include<iostream.h> void main
iPhone Loops in objective c
in Objective c with the help of few examples. But if you are new to object oriented...iPhone Loops in objective c If you have started learning Objective c... of loop examples, i have discussed about... Do loop in Objective c while loop
C++ Starter needs help :S
C++ Starter needs help :S  Hi, im 15 & im trying to learn how to program, i am starting with C & C++ since these are (what ive been told... questions abaut C++. Please help! :(   Please visit the following link: C
String substring(int beginIndex, int endIndex)
String substring(int beginIndex, int endIndex)  ... explanation about the substring(int beginIndex, int endIndex) method of String class. We are going to use substring(int beginIndex, int endIndex) method of String
Help!
Help!  thanks for ur code, I'd like to ask a question: after press "c" or "C", timer starts and after every delay ms, it'll print "This line is printed only once." or just print once. I'm writting a timer but it seems to perform
Help
Help  Hi; Can anyone help me to solve this errors. I use J2ME... saved Building "SlideImageMIDlet" C:\Documents and Settings\???? ?????\j2mewtk... symbol : class SlideMenu location: class IconsCanvas SlideMenu menu = null; ^ C
hi need help with C++ programming!
hi need help with C++ programming!  how do i : b. Store numbers / characters into the file (output) c. Retrieve numbers / characters from the file...; "Unable to open file"; return 0; } c) #include <iostream> #include <
Taking Substring
Taking  Substring      ... of substring()  method. The methods used: substring(int i.... substring(int start,int end): This is used to find the substring between start
help
"; else return "C"; } public String Convert(String Name){ return...) return "B"; else return "C... based on the percentage of cheating. please help me
help
. b. calculateTotalPayment() method calculates the total payment c. display

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.