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
What is a newline escape sequence? - A newline escape sequence is signified by the \n character. - It is used to insert a new line whereas displaying the output data. - T

Write a simple telephone book program that stores the names and phone numbers of your friends/acquaintances in a file. Your program should have the abilities to: a. Add entries (n

C Program for REMOVING CHAR WHICH U WANT void main() {           int i,j;           char a[100],r;           clrscr();           for(i=0;i

programing code on board coloring in clanguage


Data is required to be fed into the program (input) and sent out of the program (output). Considering the draughtsman using a CAD station, the input is his commands to cause lines/


#questi An array of n numbers is given, where n is an even number. The maximum as well as minimum of these given numbers need to be determined. Which of the following is true about

# Dear I want help to programmer that write C++ code for my small project as soon as posible If we can help me?..

C Program for SORTING OF LONG WORD WITH DIFFERENT STRING #include stdio.h> #include conio.h> #include string.h>   void main() {           char n[50],c[25][25]