欢迎光临散文网 会员登陆 & 注册

全自动发卡网源码系统_彩虹发卡网源码搭建

2023-06-25 10:56 作者:bili_57433813140  | 我要投稿

  新版发卡网源码库可以通过两种方式调用:按值调用或按引用调用。这两种方式通常通过作为参数传递给它们的值的类型来区分。传递给函数的参数称为实际参数,而函数接收的参数称为形式参数。

  PHP发卡系统编程开发引入了一个称为字符文字的基本类别,其目的是体现单个字符。使用引号来定义它们,例如“a”、“z”或“0”。但在以前的版本中,字符文字的可用选择仅限于相对较小的 ASCII 字符池。彩虹发卡网源码的合并拓宽了字符字面上可以描述的字符范围,涵盖了所有可用的 Unicode 字符。Unicode 是计算机系统中字符表示的标准,其中包括世界上大多数书写系统的字符以及许多其他符号。

  源码:paywks.top/ka

  在开源发卡网代码中,非成员伙伴函数可以在不是成员的情况下访问类的私有成员。类定义声明它们是友元。向量容器是PHP标准库 (STL) 中的动态数组,可以在添加或删除成员时动态调整大小。您可能需要使用向量建立一个新类,以便在向量数据上使用非成员友元方法。

  按值调用

  在参数传递的按值调用方法中,实际参数的值被复制到函数的形式参数中。

  参数的两个副本存储在不同的存储位置。

  一种是原件,一种是功能件。

  函数内部所做的任何更改都不会反映在调用者的实际参数中。

  按值调用的示例

  下面的例子演示了参数传递的传值调用方法

  #include <stdio.h>

  // Function Prototype

  void swapx(int x, int y);

  // Main function

  int main()

  {

      int a = 10, b = 20;

      // Pass by Values

      swapx(a, b);

      printf("In the Caller:\na = %d b = %d\n", a, b);

      return 0;

  }

  // Swap functions that swaps

  // two values

  void swapx(int x, int y)

  {

      int t;

      t = x;

      x = y;

      y = t;

      printf("Inside Function:\nx = %d y = %d\n", x, y);

  }

  因此,即使在函数中交换 x 和 y 的值后,a 和 b 的实际值也保持不变。

  通过参考调用

  在参数传递的引用调用方法中,实际参数的地址作为形式参数传递给函数。

  实际参数和形式参数都指的是相同的位置。

  函数内部所做的任何更改实际上都会反映在调用者的实际参数中。

  通过引用调用的示例

  以下 PHP 程序是引用调用方法的示例。

  // Function Prototype

  void swapx(int*, int*);

  // Main function

  int main()

  {

      int a = 10, b = 20;

      // Pass reference

      swapx(&a, &b);

      printf("Inside the Caller:\na = %d b = %d\n", a, b);

      return 0;

  }

  // Function to swap two variables

  // by references

  void swapx(int* x, int* y)

  {

      int t;

      t = *x;

      *x = *y;

      *y = t;

      printf("Inside the Function:\nx = %d y = %d\n", *x, *y);

  <spanstream>标头是PHP标准库集合中的新增内容。它为输入和输出提供固定的字符缓冲流。

  它是类和函数模板的集合,可让您像流一样操作字母拉伸,非常类似于 <stringstream> 或 <istringstream>。但是,它与std::span<char>一起使用,而不是从字符串或缓冲区中提取或写入。

  std:;spanstream 是为basic_spanstream<char>定义的 typedef 名称,它只不过是一个基于 span 的字符串 I/O 缓冲区。我们可以使用 std::span 对象初始化此类的对象,然后我们可以将其用作输入和输出的单独字符串缓冲区。

  #include <spanstream>

  int main()

  {

  // A string with some data

  std::string data = "3.45 5.67 4.64";

  // A span<char> from the string

  std::span<char> inSpan(data);

  // creating a spanstream object initialized with spn

  std::spanstream inSpanStream(inSpan);

  // Use the >> operator to read three double values from

  // the spanstream

  double geeks_double1, geeks_double2, geeks_double3;

  inSpanStream >> geeks_double1 >> geeks_double2

  >> geeks_double3;

  // Print out the value of double1, double2 and double3

  std::cout << "geeks_double1 = " << geeks_double1

  << "\n";

  std::cout << "geeks_double2 = " << geeks_double2

  << "\n";

  std::cout << "geeks_double3 = " << geeks_double3

  << "\n";

  // Another span container with test string data

  std::string data_t = "This is a test";

  std::span<char> outSpan(data_t);

  //  A spanstream from the span<char>

  std::spanstream outSpanstream(outSpan);

  // Use the << operator to write data to the spanstream

  // just like normal stream

  outSpanstream << "GeeksforGeeks ";

  // Print out the data stored in outSpanstream

  std::cout << "Result: " << outSpanstream.rdbuf()

  << "\n";

  return 0;

  }

  }

  并行编程是将大型任务分解为可以同时执行的较小子任务的过程,从而更有效地利用可用的计算资源。OpenMP 是一种广泛使用的发卡系统开发并行编程 API。它允许开发人员通过向现有代码添加简单的编译器指令来轻松高效地编写并行代码。

  在此示例中,我们定义了两个函数“sum_serial”和“sum_parallel”,它们使用 for 循环计算前 n 个自然数的和。“sum_serial”函数使用串行实现,而“sum_parallel”函数使用 OpenMP 并行化 for 循环。然后,我们通过使用 n=100000000 调用两个函数并使用 chrono 库中的 high_resolution_clock 类测量完成任务所需的时间来对这两个实现进行基准测试。

  下面是上面例子的实现:

  #include <chrono>

  #include <iostream>

  int sum_serial(int n)

  {

      int sum = 0;

      for (int i = 0; i <= n; ++i) {

          sum += i;

      }

      return sum;

  }

  // Parallel programming function

  int sum_parallel(int n)

  {

      int sum = 0;

  #pragma omp parallel for reduction(+ : sum)

      for (int i = 0; i <= n; ++i) {

          sum += i;

      }

      return sum;

  }

  // Driver Function

  int main()

  {

      const int n = 100000000;

      auto start_time

          = std::chrono::high_resolution_clock::now();

      int result_serial = sum_serial(n);

      auto end_time

          = std::chrono::high_resolution_clock::now();

      std::chrono::duration<double> serial_duration

          = end_time - start_time;

      start_time = std::chrono::high_resolution_clock::now();

      int result_parallel = sum_parallel(n);

      end_time = std::chrono::high_resolution_clock::now();

      std::chrono::duration<double> parallel_duration

          = end_time - start_time;

      std::cout << "Serial result: " << result_serial

                << std::endl;

      std::cout << "Parallel result: " << result_parallel

                << std::endl;

      std::cout << "Serial duration: "

                << serial_duration.count() << " seconds"

                << std::endl;

      std::cout << "Parallel duration: "

                << parallel_duration.count() << " seconds"

                << std::endl;

      std::cout << "Speedup: "

                << serial_duration.count()

                       / parallel_duration.count()

                << std::endl;

      return 0;

  }


全自动发卡网源码系统_彩虹发卡网源码搭建的评论 (共 条)

分享到微博请遵守国家法律