本文整理汇总了C++中Assignment::setDueDate方法的典型用法代码示例。如果您正苦于以下问题:C++ Assignment::setDueDate方法的具体用法?C++ Assignment::setDueDate怎么用?C++ Assignment::setDueDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assignment
的用法示例。
在下文中一共展示了Assignment::setDueDate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
bool quit = false;
ifstream inputFile;
ofstream outputFile;
string filename;
cout << "Assignment Manager" << endl << endl; // Title.
char menuChoice = '9'; // Force the filename prompt.
AssignmentFile assignments;
// Loop the program until the user quits.
while (!quit)
{
if (menuChoice == '9') // Prompt for the filename.
{
while (filename == "")
{
cout <<
"Enter the name of the assignment file (or 'q' to quit): ";
cin >> filename;
cout << endl;
if (filename == "q" || filename == "Q")
// Allow the user to quit here.
{
quit = true;
exit(0);
}
inputFile.open(filename);
if (!inputFile) // If the file does not exist, create it.
{
outputFile.open(filename);
if (!outputFile) // If the name is invalid:
{
cout << "Error: Cannot write to file." << endl << endl;
filename = "";
}
outputFile.close();
}
assignments.read(inputFile);
// Read the assignment data, if any.
inputFile.close();
}
}
displayMenu();
string menuChoiceStr;
cin >> menuChoiceStr;
menuChoice = menuChoiceStr[0]; // Only use the first input character.
cout << endl;
// Create assignment variables to be populated.
Assignment newAssignment;
string inputAssignedDate;
string inputDueDate;
string inputCompletedDate;
string inputDescription;
string inputStatus;
switch(menuChoice)
{
case '1': assignments.completed.displayAll(cout);
assignments.uncompleted.displayAll(cout);
cout << endl; break;
case '2': cout << "Enter the assigned date: ";
cin >> inputAssignedDate;
cout << endl << "Enter the description (no spaces): ";
cin >> inputDescription; // Assumes the user does not enter spaces.
cout << endl << "Enter the due date: ";
cin >> inputDueDate;
cout << endl << "Enter the status (assigned/completed/late): ";
cin >> inputStatus;
// Take assignment data from the user.
newAssignment.setAssignedDate(inputAssignedDate);
newAssignment.setDueDate(inputDueDate);
newAssignment.setDescription(inputDescription);
newAssignment.setStatus(assignments.convertStatus(inputStatus));
// Create the assignment.
if (!assignments.uncompleted.addAssignment(newAssignment))
// Add the assignment to the uncompleted list, if possible.
cout << endl << "Cannot add assignment" << endl;
cout << endl;
break;
case '3': cout << "Enter the assigned date: ";
cin >> inputAssignedDate;
cout << endl << "Enter the new due date: ";
cin >> inputDueDate;
cout << endl;
// Take the new data from the user.
if (!assignments.uncompleted.editAssignment(inputAssignedDate, "", inputDueDate))
// Edit the uncompleted assignment, if possible.
cout << "Cannot edit assignment" << endl << endl;
break;
case '4': cout << "Enter the assigned date: ";
cin >> inputAssignedDate;
//.........这里部分代码省略.........