I have a program that erases junk on a floppy disc that is inserted in a drive...
I want to implement a try - catch statement that 'tries' to delete the things on the floppy.. but 'catches' the program if a) there is no floppy in the drive.... or b) there are no fdiles on the floppy....
I have tried numerous websites but they are all hard to follow.. or are tough to relate to my program.. so I was wondering if someone could code one into the code that I already have? so I can learn how it works?
HEre is the code I am working with...
using namespace std;
//calls the get input function.
int choice, choice2;
system("cls"); //clears the screen...just to keep it clean.
cout << "This program will clean your floppy of files. 1=continue 2=quit" << endl;
cin >> choice;
if (choice == 1)
cout << "Thank you for playing! Goodbye!" << endl;
//end of get input
cout << " " << endl;
cout << " Do you have more to erase? 1=yes 2=no" <<endl;
cin >> choice2;
if(choice2 == 1)
// this if statement calls the get input function...whice takes it
// back to the beginning.
cout <<" Thank you for using my program! " << endl;
//end of erase
Inside the erase function...the line with: system("del a:\\"); is where I want the statement to be at...
If I were shown how to impliment something like this.. I would much apprechiate it.