C program to returns the string, C/C++ Programming

Assignment Help:

Program is to take two arguments and returns the string:

Program is to take two arguments and returns the string which is larger the larger string has larger ascii value invoke function from main

int compare(char *st,char *st2);

 

void main()

 {

 clrscr();

 int x;

 char st[20],st2[20];

 int ans;

 cout<<" enter the first string ";

 gets(st);

 cout<<" enter the second string ";

 gets(st2);

 ans=compare(st,st2);

 if (ans==0)

   cout<<" the larger string is "<

 else

   cout<<" the larger string is "<

 }

 

 int compare(char *st,char *st2)

   {

   int i=0;

   while(st[i]!='\0' && st2[i] != '\0')

     {

      if (st[i]==st2[i])

                {

       i++;

                }

       else if (st[i]>st2[i])

                 return 1;

       else

                 return 0;

     }

   return 0;

   }


Related Discussions:- C program to returns the string

How the operations are performed in a single linked list, Question: (a)...

Question: (a) Explain a linked list. (b) Describe the three different types of linked list with the help of diagrams. (c) Give two advantages and two disadvantages

Introduction of computer and programming concept, Classify computer system ...

Classify computer system according to capacity. How they are different from computers according to the classification of technology. Provide comparative study also.

Resection method, recsection method source code for searching position

recsection method source code for searching position

Programming, what is the first thing I need to know about Programming?

what is the first thing I need to know about Programming?

Sparce matrices, Write an algorithm for multiplication of two sparse matric...

Write an algorithm for multiplication of two sparse matrices using Linked Lists.

C code, how can i easily make a program?

how can i easily make a program?

A palindrome is a string that reads the same from both the e, submitting so...

submitting solutions in C language should not use functions from / as these files do not exist in gcc

C language, in a program for what purpose print f and scan f is used

in a program for what purpose print f and scan f is used

Should my constructors employ"assignment"or"initialization, Should my const...

Should my constructors employ "assignment" or "initialization lists"?

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd