c++ - 如何在 omnet++ 中创建循环?

标签 c++ network-programming omnet++

如何使用用户定义的变量在 omnet++ 中创建循环。 我尝试了以下但它给了我一个错误: 网络网络{

  parameters:

        int n @prompt("enter number") = default(2);

    connections:

        for i=0..n do { // here the n gives me a syntax error (unexpected NAME, expected { 
            //do things

        }   

最佳答案

看看 OMNeT++ manual . for 语法没有do,例如

for i = 0..count-2 {
        node[i].port[1] <--> node[i+1].port[0];
}

关于c++ - 如何在 omnet++ 中创建循环?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33419584/

相关文章:

c++ - 在 C++ 中检查文件是否存在

c++ - 如何检查 Windows 可执行文件是否在 session 0 进程中运行?

python - 如何通过 scapy 发送 FIN 数据包关闭连接?

c++ - 我正在尝试在 Omnet 中模拟网络。但是我收到一条错误消息“ Unresolved inclusion <csimplemodule.h>?我应该如何解决这个问题?

c++ - 实现一些验证......卡住了

c++ - 没有工作功能没有错误

routes - VEINS:动态重新路由算法

c++ - 我想在 omnet++ 中模拟客户端/服务器场景?

c++ - linux 发送带有标志 MSG_DONTWAIT 的调用

vb.net - VB.net 中的 Winsock 不工作