Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



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

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


nazi nazanin
help with substring in c programing
2 Answer(s)      3 years and 7 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


Advertisement
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 Tutorials/Questions & Answers:
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++ programing
C++ programing  how to change constants to be randomly generated
Advertisements
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
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
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
Programing Help - Java Beginners
Programing Help  how to design a filebrowser in java "witout using Swing
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
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
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
Hello if anyone can help I would like to know why I get this error when executing
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 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
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
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
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
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
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
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 <
help me on jstl- <c:url> - JSP-Servlet
help me on jstl c:url  what is jstl in java
find and substring
find and substring   **import java.io.BufferedReader; import... String"); String findstring = keybord.readLine(); String substring = keybord.readLine(); findreplace(findstring,substring); } catch(IOException io
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
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
socket programing in servlet
socket programing in servlet  give me a example to write socket programing in servlet
Advertisements
 

 

 

DMCA.com