Wednesday, March 24, 2010

Basic OOPS concept Ques 1(My Folder)

#include
#include
#include

class myfolder
{
private: char filename[10][25];
long totspace();
long usedspace();
public: void newentry();
void showfiles();
float retspace();
};

void myfolder::newentry()
{
cout<<"Enter flenames:\n";
for(int i=0; i<10;>
gets(filename[i]);
cout<
}

long myfolder::totspace()
{
long t=10*25*1;
return(t);
}

long myfolder::usedspace()
{
long j, space=0;
for(int i=0; i<10;>
{
j=0;
while(filename[i][j]!='\0')
{
space++;j++;
}
space++;

}
return(space);
}

float myfolder::retspace()
{
long tot= totspace();
long used= usedspace();
float kb= float(tot-used)/1024;
cout<<"Total space="<<<" bytes."<
cout<<"Used space="<<<" bytes."<
return(kb);
}

void myfolder::showfiles()
{
for(int i=0; i<10;>
{
cout<<<". ";
puts(filename[i]);
}
}

void main()
{
clrscr();
int n;
float KB=0;
myfolder mf;

mf.newentry();

KB=mf.retspace();
cout<<"Total space available is "<<< "KB."<<

mf.showfiles();
getch();
}


5 comments:

  1. People please add the header files iostream, conio and stdio...
    It is showing some errors while posting..

    ReplyDelete
  2. gagneet r u gonna update dis throughout d year?

    ReplyDelete
  3. wow man.....cool
    u took my rply seriously...nyway good for me
    thanx

    ReplyDelete
  4. @priyanka.... I don't know.. You people should keep motivating me... :D

    ReplyDelete
  5. @gagneet- get me ur id...i've done d 5th n 6th programs .

    ReplyDelete