Powered by Blogger.

command line arguments in C++



Command Line Arguments in C++


Whenever you want to pass argument at execution time of code; this is only possible with the help of Command Line Arguments. It is used to give input to a program that you are going to execute.
Here we discuss about Command line arguments in C++

The main function would be the following:

int main (int argc, char *argv[])
command line arguments in C++

Example of Command line arguments in C++


#include<iostream.h>
using namespace std;
int main(int argc, char *argv[])
{
    int i;
    for (i = 1; i < argc; i++)
    {
        cout << argv[i];
        if (i < argc - 1)
            cout << " ";
    }
    cout << endl;
    return 0;
}






facebook
google-plus
twitter
pinterest

No comments :

Post a Comment

HTML Tutorial

images

About Sitesbay

This blog is related to Java Tutorial, C++ Tutorial, C Tutorial, Online Earning tips and more in very simple and easy way. Here i will try to give complete idea related to all new technology.

Java Tutorial

Java is Object oriented programming language, It is more secure and high performance language.

C++ Tutorial

C++ is also Object oriented programming language, It is more simple and easy to learn.

 
https://sitesbay.blogspot.com/?utm_medium=d2898efa59afcc0bc411921036e22b767ca37b09