Post ur C/C++ Programs Here

its pretty simple just click on the # tool in advanced post and

Code:
type your code here
 

Attachments

  • bbcode.jpg
    bbcode.jpg
    99.1 KB · Views: 103
iml3g3nd said:
program request !!!

can nybody tell me how to print a name in the below format?

eg:

ranjini
anjinir
njinira
jiniran
iniranj
niranji
iranjin
ranjini

i used 3 loops!!!

one to put the first letter to last position !
the second to left shift the whole thing !
and the last loop to print the name till it ragains its original meaning !!
it didnt work !!!

c program !!!!

and can nyone tell me the bbcode to make a code in ur post??????????

many ppl have already posted about this.

please donot just beg for code which you are supposed to do as an assignment or project. If you have taken the effort to even try, post your code so that we can help you in finding the problems/errors.

blindly copying other people's code is not going to help you in the long run.

This thread was about posting your code so that others can learn from it and also point out your mistakes from which you can learn too.

techman said:
Thanks for waking up my C ...... enthusiasm

"Give a man a fish and you feed him for a day. Teach a man how to fish and you feed him for a lifetime."
- Lao Tzu

cant say anything else.
 
pr0ing said:
many ppl have already posted about this.

please donot just beg for code which you are supposed to do as an assignment or project. If you have taken the effort to even try, post your code so that we can help you in finding the problems/errors.

blindly copying other people's code is not going to help you in the long run.

This thread was about posting your code so that others can learn from it and also point out your mistakes from which you can learn too.
+1
u got d right point y i made this thread!!!

pr0ing said:
"Give a man a fish and you feed him for a day. Teach a man how to fish and you feed him for a lifetime."
- Lao Tzu
so true!!!
 
how to mantain a library-c++ program!!
#include<fstream.h>
#include<stdio.h>
#include<conio.h>
class book
{
int bookno;
char bookname[20];
char author[20];
char publisher[20];
float price;
int noofcopies;
int noofcopiesissued;
public:
int retbookno(){return bookno;}
void getdata();
void issue();
void returnbook();
void putdata();
};
void book::getdata()
{
cout<<"Enter Book Number";
cin>>bookno;
cout<<"Book Name";
gets(bookname);
cout<<"Publisher Name";
gets(publisher);
cout<<"Author Name";
gets(author);
cout<<"Price";
cin>>price;
cout<<"No of copies";
cin>>noofcopies;
noofcopiesissued=0;
}
void book::issue()
{

if(noofcopies>noofcopiesissued)
noofcopiesissued++;
else
cout<<"Sorry all copies are issued";
}
void book::returnbook()
{
noofcopiesissued--;
}
void book::putdata()
{
cout<<"Book Number:\t"<<bookno<<endl;
cout<<"Book Name\t"<<bookname<<endl;
cout<<"Publisher\t"<<publisher<<endl;
cout<<"Author\t"<<author<<endl;
cout<<"No of copies issued"<<noofcopiesissued<<endl;
cout<<"No of copies"<<noofcopies<<endl;
}
void main()
{
clrscr();
book obj;
int ch;
char ans;
fstream finout;
do
{
cout<<"\t\t\tMENU\n";
cout<<"\tchoice\tfunction\n";
cout<<"1.\tAdd Books\n";
cout<<"2.\tIssue Book\n";
cout<<"3.\tReturn Book\n";
cout<<"4.\tDisplay Books\n";
cout<<"5.\tExit\n";
cout<<"Enter your choice";
cin>>ch;
switch(ch)
{
case 1:
fstream fout("Library1.dat",ios::app);
do
{
obj.getdata();
fout.write((char*)&obj,sizeof(obj));
cout<<"do u wanna cntinue";
cin>>ans;
}while(ans=='y'||ans=='Y');
fout.close();
break;
case 2:
int c=0;
int bno;
cout<<"Enter Book Number";
cin>>bno;
finout.open("Library1.dat",ios::in|ios::eek:ut);
while(finout.read((char*)&obj,sizeof(obj)))
{
c++;
if(obj.retbookno()==bno)
{
obj.issue();
finout.seekp((c-1)*sizeof(obj));
finout.write((char*)&obj,sizeof(obj));
break;
}
}
finout.close();
break;
case 3:
c=0;
bno;
cout<<"Enter Book Number";
cin>>bno;
finout.open("Library1.dat",ios::in|ios::eek:ut);
while(finout.read((char*)&obj,sizeof(obj)))
{
c++;
if(obj.retbookno()==bno)
{
obj.returnbook();
finout.seekp((c-1)*sizeof(obj));
finout.write((char*)&obj,sizeof(obj));
break;
}
}
finout.close();
break;
case 4:
finout.open("Library1.dat",ios::in);
while(finout.read((char*)&obj,sizeof(obj)))
obj.putdata();
finout.close();
break;
}
}while(ch!=5);
}
 
What do you expect by giving this code :huh: ... has bug or something? :crazy: ... or just for students who want to copy paste in their assignments ? :argue: please mention the purpose of the post or else its of no use :no:
 
Back
Top