brintos

brintos / llvm-project-archived public Read only

0
0
Text · 810 B · cc5f52d Raw
54 lines · cpp
1#include <iostream>2#include <string>3#include <cstring>4 5struct Five6{7    int number;8    const char *name;9};10 11Five12returnsFive()13{14    Five my_five = {5, "five"};15    return my_five;16}17 18unsigned int19fib(unsigned int n)20{21    if (n < 2)22        return n;23    else24        return fib(n - 1) + fib(n - 2);25}26 27int28add(int a, int b)29{30    return a + b;31}32 33bool34stringCompare(const char *str)35{36    if (strcmp( str, "Hello world" ) == 0)37        return true;38    else39        return false;40}41 42int main (int argc, char const *argv[])43{44    std::string str = "Hello world";45    std::cout << str << std::endl;46    std::cout << str.c_str() << std::endl;47    Five main_five = returnsFive();48#if 049    print str50    print str.c_str()51#endif52    return 0; // Please test these expressions while stopped at this line:53}54