I started taking a C++ class two weeks ago, so I'm relatively new to this. I'm trying to grasp the fundamentals of arrays, but I'm absolutely stuck with this problem.
I'm trying to write a program that has a declaration in main() to store the string "Vacation is near"
into an array named 'message'. It should have a function call to 'display()' that accepts 'message' in a parameter
named 'strng' and then display the first eight elements (by 'elements', does that include spaces?) of the 'message' array.
I'm not exactly sure as to what to put inside the 'for' loop.
If you could help clarify, I'd appreciate any help!
My program is here:
Code:#include <iostream> using namespace std; // function prototype void display(char[]); int main() { char message[] = "Vacation is near"; // call display() function display (message); system ("pause"); return 0; } void display(char strng[]) { for (int i = 0; i < 8; i++) { // I'm completely confused as to what to put here? } return; }