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

📄 countneighbors.cpp

📁 大名鼎鼎的传感器网络仿真实验室平台SENSE
💻 CPP
字号:
#include <algorithm>#include "SimInfo.h"#include "usage.h"#include "file.h"#include "commonRtns.h"using namespace std;void	processNode( const NodeList::value_type info);const char	usage[] = {"<statusFileName>\n"};int		totalNeighbors = 0;int main(  int		argc,  char		*argv[]){  if( argc != 2)    printUsage( argv[0], usage);  // parse file  openFile( argv[1]);  parse();  closeFile();  if( nodeList.size() == 0)    return 1;  printf( "Node\t# Neighbors\n");  for_each( nodeList.begin(), nodeList.end(), processNode);  printf( "Average # neighbors: %f\n", (float) totalNeighbors/nodeList.size());  return 0;}void processNode(  const NodeList::value_type	info){  NodeInfo	*nodeInfo = info.second;  int		numNeighbors = nodeInfo->neighborList.size();  printf( "%3d\t%3d\n", info.first, numNeighbors);  totalNeighbors += numNeighbors;  return;}/* end file findNeighbors.cpp */

⌨️ 快捷键说明

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