So the program is supposed to use a loop to count the total size of the array of characters that contains "Hello World!", return that count as an int, and then call a function that uses pointers to start at the beginning and end of the array to swap the characters until the null point " " in between the words. I have largely figured out the code, but it won't compile correctly and won't display or won't complete the swap, I keep getting the following error:
"LNK1168 cannot open Lab06.exe for writing"
How can I fix this?
#include "targetver.h"
#include <iomanip>
#include <array>
#include <stdio.h>
#include <tchar.h>
#include <string>
using namespace std;
int main()
{
//int to hold size of array
int count = 0;
// declare a c-string to reverse
char myString[] = "Hello world!";
//print array as is
cout << myString << endl;
//find size of the array
// call the reverser function
reverser(myString, count);
// output the result
cout << myString << endl;
system("PAUSE");
return 0;
}
int findSize(char myString[], int count)
{
count = (unsigned)strlen(myString);
cout << "The size of the Array is: " << count << endl;
return count;
}
void reverser(char myString[], int count)
{
findSize(myString, count);
char *strPtr;
char *endPtr;
endPtr =& myString[count];
strPtr = myString;
for (int x = 0; x <= count; x++)
{
strPtr++;
*strPtr = myString[x];
endPtr--;
*endPtr = myString[count--];
*strPtr = *endPtr;
cout << strPtr << endl;
cout << endPtr << endl;
}
}