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

Assignment Help:

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;

}

 


Related Discussions:- Program to find a greatest string: c - program

Friend function, Ask question #Minimum 100 what is friend function is used ...

Ask question #Minimum 100 what is friend function is used in c++

Academic expert for genetic algorithm, Academic expert for Genetic Algorith...

Academic expert for Genetic Algorithm Project Description: Seeking academic expert for Genetic Algorithm. Skills required are Academic Writing, Algorithm, C++ Programming,

Call by reference, Call by reference: Arguments to a function can be pa...

Call by reference: Arguments to a function can be passed in two way; one by call by value and other by call by reference.  Call by value is passed either through a constant

Data structure, explain Storage management: free storage pool, garbage coll...

explain Storage management: free storage pool, garbage collection, compaction, boundary tag method; Hash tables and hashing functions

Program to create triangles on the surface , Using your mountain project so...

Using your mountain project source code as a starting point, you are to write a code that randomly chooses one of the triangles on the surface of your mountain, this will be the en

Record of student and calculating marks using ctotal, reocord of a student ...

reocord of a student and a function ctotal to calculate the marks of any three subject by using ctotal() function

Algorithm, write a pseudo code for computing sin(x) using sentinel control ...

write a pseudo code for computing sin(x) using sentinel control loop

Data types, #question write a prog c & cpp

#question write a prog c & cpp

Tree, Ask question #M i want to undersatnd about tree structures like node ...

Ask question #M i want to undersatnd about tree structures like node leaf etcinimum 100 words accepted#

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