Data Structures & Algorithms in C++
Goodrich, Tamassia, Mount and Goldwasser
|
#include <chrono>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <string>
Functions | |
string | repeat0 (int n, char c) |
Uses appropriate string constructor to fill with n copies of character c. | |
string | repeat1 (int n, char c) |
Uses repeated += operator to compose a String with n copies of character c. | |
string | repeat2 (int n, char c) |
Uses repeated addition to compose a String with n copies of character c. | |
int | main (int argc, char *argv[]) |
Tests the three versions of the 'repeat' algorithm, with each trial doubling the size. The first command line argument can be used to change the number of trials, and the second to adjust the start value
string repeat0 | ( | int | n, |
char | c | ||
) |
Uses appropriate string constructor to fill with n copies of character c.
string repeat1 | ( | int | n, |
char | c | ||
) |
Uses repeated += operator to compose a String with n copies of character c.
string repeat2 | ( | int | n, |
char | c | ||
) |
Uses repeated addition to compose a String with n copies of character c.