Using Visual C++ 2010 Express version, write a program that has a declaration in
ID: 3637417 • Letter: U
Question
Using Visual C++ 2010 Express version, write a program that has a declaration in main() to store the string "Vacation is near” in an array named message, then add a function call to display() that accepts message in an argument named strng and then displays the contents of message by using pointer notation *(strng + i), Part then change the display() function to use the expressions *strng rather than *(strng + i). The data I have compiled keeps getting syntax errors, what am I missing.thanks so much#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[])
{
int i = 0;
while (message[i] != 0) // or != ''
cout message[i];
++i;
}
return;
Explanation / Answer
#include void display(char[]); int main() { char message[] = "Vacation is near"; display (message); return 0; } void display(char strng[]) { int i=0; while(*(strng + i) != '' { printf("%c", *(strng+i)); i++; } printf(" "); return; }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.