I need to write a program with the following instructions. I have started it but I am in desperate for help! This is a homework assignment that due tonight April 11th at midnight. If you can write a program including the following, please please please help me!
THANK YOU!!!
Description:
The purpose of this program is to introduce you to arrays. You will create a simple day planner/journal that will allow a user to choose a month, then choose a date, then write and store a note for that day. Your program should allow your user to work with the current month and the following four months (April 2014 - July 2014).
You must implement the following features, using functions where noted (you may use more functions than are noted if you wish):
four arrays, one for each month required, with the proper number of days for each
the ability for the user to select the desired month
Create a function for each of the following requirements:
the ability to view the entire month's notes at once
the ability for the user to select the desired day, and do the following with that day:
view the note
delete/clear the note
overwrite the note
the ability for the user to save all of her/his information to a text file
the ability for the user to retrieve all of her/his information from a text file
Note: you should not create a separate function for each month (don not create a function called ViewMonthApril, ViewMonthMay, etc)
your program source code must be neatly and consistently formatted [10 points]
your program cannot have any global variables (including global arrays) [15 points]
your program must compile and run without errors [15 points]
the four required months as arrays with the proper number of days for each [15 points]
user can select and work with a specific month [5 points]
user can view the whole month at once (function) [5 points]
user can view a single day's note (function) [5 points]
user can clear a single day's note (function) [5 points]
user can overwrite a single day's note (function) [5 points]
user can save program data to file (function) [5 points]
user can retrieve program data from file (function) [5 points]
your program source code must be documented correctly, including proper documentation for each of your functions [10 points]
string april[30];
string may[31];
string june[30];
string july[30];
ofstream outfile;
outfile.open("program6.txt");
cout << "Heres a calendar that's April-July" << endl;
cout << "You can view by day or view by month" << endl;
cout << "Pick month:" << endl;
cout << "1 for April, 2 for May, 3 for June, 4 for July" << endl;
cin >> userChoice;
cout << "Pick day" << endl;
cin >> userChoice;
cout << userChoice << ":" << viewNote << endl;
cout << "1 for view note, 2 for delete/clear, 3 for overwrite note." << endl;
string currentMonth;
switch (userChoice)
{
case 1:
currentMonth= "april";
break;
case 2:
currentMonth= "may";
break;
case 3:
currentMonth= "june";
break;
case 4:
currentMonth= "july";
break;
}
switch (userChoice)
{
case 1:
if (currentMonth=="april")
{
viewNote(april);
}
break;
case 2:
if (currentMonth=="may")
{
viewNote(may);
}
break;
case 3:
if (currentMonth=="june")
{
viewNote(june);
}
break;
case 4:
if (currentMonth=="july")
{
viewNote(july);
}
break;
}*/
}
/*
void viewNote (string array[30])
{
int date;
cout << "what day do you want to view?" << endl;
cin >> date;
cout << array[date-1];
}
void viewNote (string array[31])
{
int date;
cout << "What day do you want to view?" << endl;
cin >> date;
cout << array[date-1];
}
void viewNote (string array[30])
{
int date;
cout << "what day do you want to view>" << endl;
cin date;
cout << array[date-1];
}
the errors im getting are:
"80:6 redefinition of 'void viewNote(std::string*)'"
"73:6 'void viewNote(std::string*)' previously defined"
87:6 redefiniftion of 'void viewNote(std::string*)'
91:7 expected ';' before 'date'
You haven't put a function prototype for viewNote before the main function, so the compiler doesn't know what it is. You either need to move the function definition before main, or put a function prototype before main.
and here... you're not sending any parameters to viewNote, so the compiler thinks it's an undeclared variable.
i have three definitions for viewNote because i thought i would have to do that for all four months. Where can i declare the function in main and to work in the switch case?
Function prototype gives the compiler basic info about the function
returntype FunctionName (parameter types);
So if you want to send an array, include the [] so the compiler knows the parameter is an array, and you can include an int so you can send the function the array size. So one function can handle different arrays with different sizes.
void viewNote (string [], int);
Function prototypes go before main function.
1 2 3
//function prototypes
//main function
//function definitions
You're overwriting the month they pick in userChoice with the day they then choose here.
1 2 3 4 5
cout << "Pick month:" << endl;
cout << "1 for April, 2 for May, 3 for June, 4 for July" << endl;
cin >> userChoice;
cout << "Pick day" << endl;
cin >> userChoice;