TU-Programmieren_2/exercise1/task2.cpp
2025-04-09 10:22:44 +02:00

25 lines
787 B
C++

/// @file
/// @brief Task2: "single-file" excutable C++ program
#include <iostream>
/// @brief Calculate the sum of two integer values
/// @param a first integer value
/// @param b second integer value
/// @return Sum of the two integer values
int sum(int a, int b) {
return a + b;
}
/// @brief main function (entry point) conducting the following tasks in this order
/// - create two local variables holding the integer values 33 and 6600
/// - call your function 'sum' and provide the prepared variables as arguments to the call
/// - capture the result of your function call in a local variable and print it to the console
int main() {
int a = 33;
int b = 6600;
int result = sum(a, b);
std::cout << "The sum of " << a << " and " << b << " is " << result << std::endl;
}