So My program runs great in Xcode, but when Transferred to Visual Studio it dies(Says it can't find the file to run it.). Can anyone see what's wrong with my code?
//Description:/*You are writing an accounting program for a property management company. Use arrays to hold the 5 rental properties’ income. Write a function that accepts as arguments the array of integers and an integer representing the number of elements in the array. Sort the rent from high to low and then output the rents from high to low. In addition, display the memory location of first and last items in the array.*/
#include <iostream>
#include <iomanip>
usingnamespace std;
//Globals
int SIZE = 5;
//Function Prototypes
void displayMenu();
void sort(int *rentp);
void DisplayAdd(int *rentp);
int main() {
int rent[SIZE];
int option;
cout<<"First please enter the rental income of your 5 properties: \n";
for (int i = 0,count = 1; i < SIZE; i++, count++) {
cout<< "Property "<< count<<":$";
cin>> rent[i];
}
cout<<endl;
while (true) {
displayMenu();
cout<<"Please make your selection: ";
cin>> option;
cout<<endl;
switch (option) {
case 1:
sort(rent);
cout<<endl;
break;
case 2:
DisplayAdd(rent);
cout<<endl;
break;
default:
if (option != 1 && option != 2 && option != 3) {
cout<<"Invalid input, try again.\n"<<endl;
}
break;
}
if (option == 3)
break;
}
cout<<"Thank you, Good-Bye.........\n";
system("Pause");
return 0;
}
void displayMenu(){
cout<<"Menu Of Options: \n";
cout<<"1.Sort rent High to Low \n";
cout<<"2.Display the memory location of the first and last items in the array \n";
cout<<"3.Exit \n";
}
void sort(int *rentp){
int startscan,maxIndex;
double maxVal;
for (startscan = 0;startscan < (SIZE -1); startscan++){
maxIndex = startscan;
maxVal = rentp[startscan];
for (int index = startscan +1; index < SIZE; index++) {
if (rentp[index] > maxVal) {
maxVal = rentp[index];
maxIndex = index;
}
}
rentp[maxIndex] = rentp[startscan];
rentp[startscan] = maxVal;
}
cout<<"Rental Income Listed from Highest to Lowest: \n";
for (int i = 0, count = 1; i < SIZE; i++,count++) {
cout<< fixed <<showpoint <<setprecision(2);
cout<<"$"<<rentp[i]<<"\n";
}
}
void DisplayAdd(int *rentp){
cout<<"The memory location of the first item in the array: "<< &rentp[0];
cout<<endl;
cout<<"The memory location of the last item in the array:"<< &rentp[4];
cout<<endl;
}