Google PlusFacebookTwitter

Classes – My Folder

By on Apr 4, 2007 in On A Whim | 0 comments

Share On GoogleShare On FacebookShare On Twitter

/* Copyright © 2007 Ankur Banerjee. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. */

/* Classes – My Folder */

#include <iostream.h>
#include <conio.h>
#include <stdio.h>

class myfolder
char filename[10][25];
long totspace, usedspace, avspace;
void newentry();
long retspace()
avspace = (totspace – usedspace) / 1000;
return avspace;
} file;

void myfolder :: newentry()
for (int i=0; i<10; i++)
cout<<“Enter filename for file number “<<i+1<<” : “;
cout<<“Enter total space allocated in bytes : “;
cout<<“Enter used space in bytes : “;
if (totspace < usedspace)
cout<<“Total space cannot be less than used space. “
<<“Please enter again”<<endl;
} while (totspace < usedspace);

void myfolder :: showfiles()
for (int i=0; i<10; i++)
cout<<endl<<“Filename for file number “<<i+1<<” is : “
cout<<endl<<“Total space allocated in bytes is “
<<“Used space in bytes is “<<usedspace;

void main()
long res;
cout<<“Enter data for files”<<endl;
cout<<endl<<“Displaying data for files”;file.showfiles();
res = file.retspace();
cout<<endl<<“Total available space in kilobytes is “

/* Output */

Enter data for files
Enter filename for file number 1 : Hitchhiker’s
Enter total space allocated in bytes : 2356565
Enter used space in bytes : 1234547

Displaying data for files
Filename for file number 1 is Hitchhiker’s
Total space allocated in bytes is 2356565
Used space in bytes is 1234547
Total available space in kilobytes is 1122.018

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.