#include <ctime>

#include <cstdlib>

#include <string>

#include <iostream>

using namespace std;

int main() {  

   string charSet;

   int times = 100;

   int magic, i;  

  char randomChar;

   srand(time(NULL));

   for (i = 1; i<= times; i++)  

    {   magic = rand()%26;  

       randomChar = 'a'+magic;

      charSet += randomChar;

     }

   cout << "random char set:\n"<<charSet<<endl;  return 0;

}

 

 

 

// #include<iostream>
// using namespace std;
// void swap(int *p1,int*p2)
// {
//  int temp;
//  temp = *p1;
//  *p1 = *p2;
//  *p2 = temp;
//
// }
// int main()
// {
//  int x1 = 3,x2 = 5;
//  cout << "before swap,x1 = "<<x1<<",x2 = "<<x2<<endl;
//  swap(&x1,&x2);
//  cout << "after swap,x1 = "<<x1<<",x2 = "<<x2<<endl;
// }

相关文章:

猜你喜欢
  • 2022-12-23
  • 2021-07-17
  • 2021-12-29
  • 2022-01-07
  • 2021-10-12
  • 2022-12-23
  • 2021-10-28
相关资源
相似解决方案