Program to find a greatest string: c - program , C/C++ Programming

Program to find a Greatest String: C - Program:

Write a program find largest string by c program.

int main( int argc, char *argv[] )

{

    if( argc < 2 )

        {

        cerr << "Usage:  strngmax string1 [string2 ...]\n";

        return 1;

        }

 

    String theGreatestString( argv[1] );

    int positionOfTheGreatestString = 1;

    int nextArg = 2;

 

    while( nextArg < argc )

        {

        String argListString ( argv[nextArg++] );

        if ( argListString > theGreatestString )

            {

            theGreatestString = argListString;

            positionOfTheGreatestString = nextArg - 1;

            }

        }

 

    cout << theGreatestString << endl;

    return positionOfTheGreatestString;

}

 

Posted Date: 10/19/2012 3:07:51 AM | Location : United States







Related Discussions:- Program to find a greatest string: c - program , Assignment Help, Ask Question on Program to find a greatest string: c - program , Get Answer, Expert's Help, Program to find a greatest string: c - program Discussions

Write discussion on Program to find a greatest string: c - program
Your posts are moderated
Related Questions
A company needs 200 pencils per year . you cannot simply use this price as the cost of pencils two years from now. Because of inflation the cost is likely to be higher than it is

Cross Platform Clinet app for a vpn Project Description: We want a cross platform client app for VPN. The app must have the subsequent options below: 1. Must be an open

I. COURSE DESCRIPTION Develops a working knowledge of object-oriented concepts in areas of classes, inheritance, data structures, error handling, templates and file processing.

PROCEDUAL PROGRAMMING INTRODUCTION

Tell what the derived class inherits or doesn't inherit? A: Inherits: - All data member defined in the parent class (even though such members might not always be accessible

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

I need help to understand and do this assignment ********************************************************* You are to insert the missing code in the C program given for combinatio

Available in the string.h header file are the following routines         strcat(string1,string2);   This joins string2 to string1; care must be taken to allocate enough space for

For Loop with inner loop

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