-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray_addition_tb.cpp
More file actions
42 lines (32 loc) · 895 Bytes
/
array_addition_tb.cpp
File metadata and controls
42 lines (32 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// File: array_addition_tb.cpp
#include <iostream>
#include <cstdlib>
#include "array_addition.h"
#define SIZE 10
int main() {
int a[SIZE], b[SIZE], result[SIZE];
// Initialize arrays with random values
for (int i = 0; i < SIZE; ++i) {
a[i] = rand() % 100;
b[i] = rand() % 100;
}
// Call the array addition function
array_addition(a, b, result, SIZE);
// Display the result
std::cout << "Array A: ";
for (int i = 0; i < SIZE; ++i) {
std::cout << a[i] << " ";
}
std::cout << std::endl;
std::cout << "Array B: ";
for (int i = 0; i < SIZE; ++i) {
std::cout << b[i] << " ";
}
std::cout << std::endl;
std::cout << "Result: ";
for (int i = 0; i < SIZE; ++i) {
std::cout << result[i] << " ";
}
std::cout << std::endl;
return 0;
}