PDA

View Full Version : سوال: ارور در سورس ++c در تابع Report



silver boy 2010
چهارشنبه 21 اردیبهشت 1390, 11:26 صبح
#include <stdio.h>
#include <iostream.h>
#include <conio.h>
#include <string.h>

struct goods{
char name[30], sn[30] , typ[30] ;
long int cost, num;
struct goods *fl , *bl;}
*start ,*cur , *p , *q;

void insert(){
char sn[30];
long int n, sw=0;
struct goods *r;
cout<<"enter your goods serial number : ";
gets(sn);
cout<<"enter number of this good:";
cin>>n;
for(p=start->fl;p!=NULL&&!sw;p=p->fl)
if(!strcmp(p->sn ,sn))
sw=1;
if(sw)
p->num+=n;
else{
r=new struct goods;
r->fl=NULL;
r->bl=cur;
cur->fl=r;
cur=r;
strcpy(r->sn, sn);
r->num=n;
cout<<"enter the name:";
gets(r->name);
cout<<"enter the type:";
gets(r->typ);
cin>>r->cost;
}}

void ereas(){
struct goods *bp , *ap;
char sn[30];
long int n , sw=0;
cout<<"enter your good serial number for delete :";
gets(sn) ;
for(p=start->fl;p!=NULL&&!sw;p=p->fl)
if(!(strcmp(p->sn , sn))){
sw=1;
if(!sw)
cout<<"not found";
else {cout<<"enter amount:";
cin>>n;
if(n>p->num){

cout<<"this amount is greater ";
cout<<p->num<<"is amount of deleted";
bp=p->bl;
ap=p->fl;
bp->fl=ap;
ap->bl=bp;
p->fl=NULL;
p->bl=NULL;
delete(p);}
else{
p->num-=n;
cout<<n<<" is amount fo deleted";}}
}}

void sort(){
struct goods *aq,*bq,*ap,*bp;
for(p=start->fl; p->fl=NULL;p=p->fl){
ap=p->fl;
bp=p->bl;
for(q=p->fl;q!=NULL;q=p->fl){
aq=q->fl;
bq=q->bl;
if(strcmp(p->name , q->name))
if(q==p->fl){
bq->fl=q;
q->bl=bq;
p->fl=aq;
aq->bl=p;
q->fl=p;
q->bl=q;}
else{
bq->fl=q;
q->bl=bq;
ap->bl=q;
q->fl=ap;
bq->fl=p;
p->bl=bq;
aq->bl=p;
p->fl=aq;}
}}}

void report-all(){
sort();
cout<<"all good";
for(p=p->start;p!=NULL;p=p->fl)
cout<<""<<p->name<<""<<p->typ<<""<<p->sn<<""<<p->num<<""<<p->cost;}

void report-type(){
char typ[30];
sort();
cout<<"enter your type:";
get(typ)
for(p=start->fl;p!=NULL;p=p->fl)
if(!strcmp(p->typ , typ)
cout<<""<<p->name<<""<<p->typ<<""<<p->sn<<""<<p->num<<""<<p->cost:}

void main (){
char ch ;
start=new struct goods ;
start->fl=NULL;
start->bl=NULL;
cur=start;
cout<<"enter a character:";
do{
ch=getch();
switch(ch){
case'i':
case'I';insert();break;
case'd':
case'D':delet();break;
case'p':
case'P':report-all();break;
case'r':
case'R':report-type();break; }
while (ch!='x'&&ch!='X');
}; }

سلام من این برنامه رو نوشتم ولی دو تا ارور می ده نمی تونم رفعش کنم:ناراحت:
اینم ارور هاش :
size of 'report' is unknown or zero
Declaration syntax error


در ضمن گشتم جایی پیدا نکردم سوالمو بپرسم بخاطر همین تاپیک زدم:لبخندساده:

حامد مصافی
چهارشنبه 21 اردیبهشت 1390, 16:02 عصر
متن خطا رو قید کنید و عنوان تاپیک رو به جمله مناسب تری تغییر بدید لطفا
با تشکر :-)

silver boy 2010
چهارشنبه 21 اردیبهشت 1390, 23:54 عصر
متن خطا رو قید کنید و عنوان تاپیک رو به جمله مناسب تری تغییر بدید لطفا
با تشکر :-)
حامد جان اگر عنوان بهتری واسه تاپیک دارید لطفا راهنمایی بفرمایید:لبخندساده:
ممنون از توجهتون