New at c++

John Love-Jensen eljay@adobe.com
Tue Jun 10 19:00:00 GMT 2008


Hi Lopezio,

> I program in Pascal with parameters and my programs run like
> nameofprogram.exe param1 param2
> How can i do the same in c++?

Your question is off-topic for this forum.  This is a GCC specific help
forum, and your question is a general C++ question.  I'm not pointing this
out to chastise you.  I'm pointing it out because there are more suitable
forums for general C++ questions, with which you may be able to get answers
to your general C++ questions faster and/or more accurately.

That being said...

#include <iostream>
int main(int argc, char** argv)
{
  for(int i = 1; i < argc; ++i)
  {
    std::cout << "Parameter " << i << ": "
      << argv[i] << std::endl;
  }
}

HTH,
--Eljay



More information about the Gcc-help mailing list