⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 list5-2.cpp

📁 这是c++编程方面的名著的例子代码
💻 CPP
字号:
// Listing 5-2
// Demonstates the use of  execl
// one of the family of exec( ) functions
// used to spawn child processes
// accepts a sequence of four integers that will be
// passed to the program from list5-1

#include <iostream.h>
#include <strstrea.h>
#include <stdlib.h>
#include <process.h>

void main(int argc, char *argv[])
{


   if(argc == 5){
      char Argument[81] = "";
      strstream Buffer;
      Buffer << (atol(argv[1]) * 2) << " ";
      Buffer << (atol(argv[2]) * 3) << " ";
      Buffer << (atol(argv[3])+ atol(argv[1])) << " ";
      Buffer << atol(argv[4]) << ends;
      Buffer.getline(Argument,80,'\0');
      cout << "Result " << Argument << endl;
      execl("list5-1.exe","List5-1.exe",Argument,NULL);
   }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -