Untitled

mail@pastecode.io avatar
unknown
c_cpp
a year ago
1.7 kB
1
Indexable
Never
int main()
{
    double time_spent = 0.0;

    clock_t begin = clock();
    int n, num;
    setlocale(LC_ALL, "Rus");
    char* words = new char[MAX_STRING_LEN];

    words[0] = 'I';
    words[1] = ' ';
    words[2] = 't';
    words[3] = 'h';
    words[4] = 'i';
    words[5] = 'n';
    words[6] = 'k';
    words[7] = ' ';
    words[8] = 't';
    words[9] = 'h';
    words[10] = 'i';
    words[11] = 's';
    words[12] = ' ';
    words[13] = 'i';
    words[14] = 's';
    words[15] = ' ';
    words[16] = 't';
    words[17] = 'h';
    words[18] = 'e';
    words[19] = 'i';
    words[20] = 'r';
    words[21] = ' ';
    words[22] = 'h';
    words[23] = 'o';
    words[24] = 'u';
    words[25] = 's';
    words[26] = 'e';
    words[27] = ',';
    words[28] = ' ';
    words[29] = 'b';
    words[30] = 'u';
    words[31] = 't';
    words[32] = ' ';
    words[33] = 'I';
    words[34] = '`';
    words[35] = 'm';
    words[36] = ' ';
    words[37] = 'n';
    words[38] = 'o';
    words[39] = 't';
    words[40] = ' ';
    words[41] = 's';
    words[42] = 'u';
    words[43] = 'r';
    words[44] = 'e';
    words[45] = '\0'
    words = algo(words, words_arr);
    cout << "\nСлова, которые короче последнего слова:\n";
    for (string every_word : words_arr)
    {
        cout << every_word << endl;
    }

    clock_t end = clock();
    // рассчитать прошедшее время, найдя разницу (end - begin) и
    // деление разницы на CLOCKS_PER_SEC для перевода в секунды
    time_spent += (double)(end - begin) / CLOCKS_PER_SEC;

    printf("The elapsed time is %f seconds", time_spent);

    return 0;
}