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

Define Bitwise Left Shift and Right Shift Operators: >? The bitwise shift operators shift their first operand right (>>) or left ( // Illustration of the bitwise right shi

Question: (a) What is a function? Are functions needed when writing a C program? (b) State one of the advantages to the use of functions. (c) What do you meant by underst

write a program that calculates points along a rhodonea curve.... ? int fillArray( double data[ ], int nValues, double min, double max ); o Used to fill in the theta array. Return

Q: What are User Defined data types? C supports an extraordinary feature known as "type definition" that permits users to define an identifier that would represent an existing

You are to implement a code cracking system. The system will deploy four processes (p1,p2,p3 & p4) to try to guess the password of an encrypted code. For encryption, we consider th


Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

i am using mobile phone if i want to communicate via massage but that should be very secret

write a function that take as parameters an array of integer and its size and return the sum of its value