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

📄 smallkasamimain.cpp

📁 利用Visual C++编写M序列的生成以及利用给定的M序列采用采样技术生成其他的不同的序列
💻 CPP
字号:
#include "SmallKasami.cpp"
#include <stdio.h>
#include <iostream>

void main()
{
  //int i,p,m,mSeqLength,sequence[1000];

  //complex<double> complex1;

  int i,t,m1;
  int *kasami_set1;
  int length,num;

  FILE *fp;
  char filename[10];
 
 //Input the number: p,m
 //cout<<"Please input the numbers:m\np=2:binary\np=3:ternary\nor p=5,7,11,13,17,19,23,29,31\nm:the degree\np=2,4 : m=1-100\np=3 : m=1-10\np=5 : m=1-5\np=7 : m=1-4\notherwise m=2 or 3\n";

 //cin>>p>>m;

 
 

  cout <<"Please input an even number m:";
  cin >>m1;
  while (m1%2!=0)
  {
  cout <<"M must be an even number!";
  cout <<endl;
  cout <<"Please input an even number m:";
  cin >>m1;
  }
  //输入m序列的m值
  length=(int)pow(2,m1)-1;
  num=(int)pow(2,m1/2);

  if((kasami_set1=new int[length*num])==NULL)
  {
   cout <<"Can't allocate more memory,terminating.\n";
  }

  cout <<"please input the filename that we can write data on:\n";
  cin >>filename;
  SmallKasami(m1,kasami_set1);
  


  if ((fp=fopen(filename,"w"))==NULL)
  {
  printf("cannot open file\n");
  exit(0);
  }    

 //mSequence(p,m,sequence);
 
 fprintf(fp,"m=%d,the SmallKasami sequence as following:",m1);


	for (i=0;i<length*num;i++)
	{if (i%length==0) 
	{ t=i/length;
	 cout <<t;
		fprintf(fp,"\n");
	   fprintf(fp,"The No.%d smallkasami sequence is:",t+1);}
	 //  fprintf(fp," ");
       fprintf(fp,"%d",kasami_set1[i]);
	  
	}
 
    
  fclose(fp);
delete[]kasami_set1;

} 

⌨️ 快捷键说明

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