Data Structures & Algorithms in C++
Goodrich, Tamassia, Mount and Goldwasser
Loading...
Searching...
No Matches
Functions
string_experiment.cpp File Reference
#include <chrono>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <string>
Include dependency graph for string_experiment.cpp:

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[])
 

Function Documentation

◆ main()

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

Here is the call graph for this function:

◆ repeat0()

string repeat0 ( int  n,
char  c 
)

Uses appropriate string constructor to fill with n copies of character c.

◆ repeat1()

string repeat1 ( int  n,
char  c 
)

Uses repeated += operator to compose a String with n copies of character c.

◆ repeat2()

string repeat2 ( int  n,
char  c 
)

Uses repeated addition to compose a String with n copies of character c.