m
 
   Colleges and Courses  |  College Admissions  |  Campus Life  |  Academic Projects  |  Exam Notifications  |  Jobs Abroad  |  Discussions  |  Home
  IGNOU ASSIGNMENTS :


Google
 
PROBLEM SOLVING AND PROGRAMMING
COURSE CODE: MCA 011

 Code Submitted by: Gaurav Mhk 1 | 2 | 3 | 4 | 5 Submit your Code
   
Assignments
C Programming
SAD
C Programing
Compu Networks
Compu Architecture
Question Papers
Intro to Software
June 1995
Dec 1995
June 1995
Dec 1996
Dec 1997
Dec 1999
June 2000
Dec 2000
June 2001
Jan 2001
Dec 2002
Database Management
June 1995
Computer Architecture
June 1997
Dec 1997
June 1998
Dec 1998
June 1999
Dec 1999
June 2000
Dec 2000
Jan 2001
June 1995
Dec 2001
June 2002
Computer Architecture
June 1996
Dec 1996
June 1997
Dec 1997
June 1999
June 1998
Networking
June 1995
Dec 1999
June 2000
Dec 2000
Jan 2000
June 2001
Dec 2001
June 2002
Finance & Accounting
Dec 1996
June 1997
Dec 1997
June 1998
Dec 1998
June 1999
Dec 1999
June 2000
Dec 2000
June 2003
Numerical & Programming
June 2001
Dec 2001
Operations Research
June 1995
June 2002
June 2001
Software Engineering
Dec 2001
Dec 2002

Question 5

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char a[25],b[25],c[25],d[25];
int q,w,e,i,j,k;
clrscr();
printf("Enter the main string ");
fflush(stdin); /*flush the stdin in case of overflow*/
gets(a);
fflush(stdin); /*flush the stdin in case of overflow*/
printf("Enter the sub string ");
gets(b);
fflush(stdin); /*flush the stdin in case of overflow*/
printf("Enter the replacement string ");
gets(c);
fflush(stdin);
q=strlen(b); /*string length of b*/
w=strlen(c); /*string length of c*/
e=strlen(a); /*string length of a*/
strncpy(d,a,strlen(a));
if (q==w ) /*comparing two string before replacing*/
{
    for(i=0;i<=q;i++)
    {
        fflush(stdin); /*flush the stdin in case of overflow*/
        for(j=0;j<=e;j++)
            {
            fflush(stdin); /*flush the stdin in case of overflow*/
            if(b[i]==a[j])
            {
                fflush(stdin); /*flush the stdin in case of overflow*/
                d[j]=c[i]; /*modifying main string according to the replacement string*/
                fflush(stdin); /*flush the stdin in case of overflow*/
            }
        }
    }
printf("\Out put string=%s \n Substring= %s \n replace %s",d,b,c);
}
else
printf("enter same length of strings retrun the program");
getch();
}

TOP