Answer the question
In order to leave comments, you need to log in
Why doesn't the Xcode project see the features described in another file?
A simple program with array input and output functions that are in another file.
Created a command line tool project with main.cpp and added scan_print_arr.cpp to
main.cpp
#include <iostream>
#include "scan_print_arr.hpp"
#define C 17
#define A 35
int main()
{
int arr[A];
int arr1[C];
scan_arr(arr, A);
print_arr(arr, A);
scan_arr(arr1, C);
print_arr(arr1, C);
return 0;
}
#include "scan_print_arr.hpp"
#include <iostream>
void scan_arr(int arr[], int size) {
for (int i = 0; i < size; i++) {
std::cout << "arr[" << i + 1 << "] = ";
std::cin >> arr[i];
}
std::cout << std::endl;
}
void print_arr(int arr[], int size) {
for (int i = 0; i < size; i++) {
std::cout << "arr[" << i + 1 << "] = " << arr[i]
<< std::endl;
}
std::cout << std::endl;
}
Use of undeclared identifier 'scan_arr'
Use of undeclared identifier 'print_arr'
Answer the question
In order to leave comments, you need to log in
In scan_print_arr.hpp add
void scan_arr(int arr[], int size);
void print_arr(int arr[], int size);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question