i have a savage fox fp1 shotgun pump i need to no the worth of it
#include<stdio.h> #include<conio.h> int main(int x,char *a[]) { FILE *fp1,*fp2; fp1=fopen("input.txt","r"); fp2=fopen("output.txt","w"); while(!(feof(fp1))) { fputc(fgetc(fp1),fp2); } fclose(fp1); fclose(fp2); return 0; }
all it is its that the fuse box is burn an you need to replace it
FP1 means Pipe Fitter First Class. The 'FP' is the Rate (Pipe Fitter) and the '1' stands for the Rank (Petty Officer First Class).
#include#includevoid main(){char fname1[20],fname2[20],c;FILE *fp1,*fp2;printf("\nEnter file 1 name :");scanf("%s",fname1);printf("\nEnter file 2 name :");scanf("%s",fname2);fp1=fopen(fname1,"r");fp2=fopen(fname2,"a");if(fp1==NULL fp2==NULL){printf("\nSome error.");return;}while((c=fgetc(fp1))!=EOF){fputc(c,fp2);}fcloseall();printf("\nFile Appended Done.");}
#include#includevoid main(){FILE *fp1,*fp2;char ch,fname1[20],fname2[20];printf("\n enter sourse file name");gets(fname1);printf("\n enter sourse file name");gets(fname2);fp1=fopen(fname1,"r");fp2=fopen(fname2,"a");if(fp1==NULLfp2==NULL){printf("unable to open");exit(0);}do{ch=fgetc(fp1);fputc(ch,fp2);}while(ch!=EOF);fcloseall();}
//PROGRAM TO CHECK SYNTAX OF for STATEMENT #include<stdio.h> #include<conio.h> #include<string.h> #include<process.h> void main() { FILE *fp1,*fp2; char a[100],ch,b[50]; int col=0,i=0,bra1=0,bra2=0,flag=0; clrscr(); fp1=fopen("c:\\file1.txt","w"); if(fp1==NULL) { printf("\n ERROR IN OPENING FILE ... "); getch(); exit(0); } else { printf("\n ENTER THE for STATEMENT ... "); gets(a); fprintf(fp1,"%s",a); for(i=0;i<3;i++) b[i]=a[i]; b[i]=0; if(strcmp(b,"for")!=0) { printf("\n ERROR: UNDEFINED SYMBOL for "); getch(); exit(0); } if(a[i]=='(') flag=1; else flag=0; fclose(fp1); fp1=fopen("c:\\file1.txt","r"); while(1) { ch=getc(fp1); if(ch==EOF) break; else if(ch=='(') bra1++; else if(ch==')') bra2++; else if(ch==';') col++; } if(flag==0) printf("\n ERROR: UNDEFINED SYMBOL for "); else if(bra1!=1) printf("\n ERROR: BRACKET ERROR '(' "); else if(bra2!=1) printf("\n ERROR: BRACKET ERROR ')' "); else if(col!=2) printf("\n ERROR: SEMICOLON ERROR ';' "); else printf("\n NO ERROR: "); } fclose(fp1); getch(); }
#include<stdio.h> #include<conio.h> #include<string.h> struct symbol { char sn[35]; int add; }s[35]; void main() { int symerr=0,oper=0,i=1,j=1,lc,k,sa,p1,f,op,l,q,d,x=1; char opcode[50],lb[25],operand[25]; char optab[10][10]={"LDA","LDB","STA","ADD","COMP","J","JEQ","SUB","STA"}; char value[10][10]={"00","b8","0c","18","28","3C","30","lc","14","78"}; FILE *fp1,*fp2; clrscr(); fp1=fopen("input1.txt","r"); fp2=fopen("inter.txt","w"); fscanf(fp1,"%s %s",&lb,&opcode); if(strcmp(opcode,"START")==0) { fscanf(fp1,"%d",&lc); sa=lc; fprintf(fp2,"%d\t %s\t %s\t %d\n",lc,lb,opcode,lc); fscanf(fp1,"%s %s",&lb,&opcode); } while(!feof(fp1)) { d=lc; if(strcmp(".",lb)!=0) { if(strcmp("-",lb)!=0) { for(i=1;i<=j;i++) { if(strcmp(s[i].sn,lb)==0) symerr=1; break; } if(symerr==0) { strcpy(s[j].sn,lb); s[j].add=lc; j++; } } for(k=0;k<10;k++) for(l=0;l<10;l++) if(optab[k][l]==opcode) { fscanf(fp1,"%s",&operand); lc=lc+3; x=0; } if(strcmp(opcode,"RESW")==0) { fscanf(fp1,"%s",&operand); op=atoi(operand); lc=lc+(op*3); } else if(strcmp(opcode,"RESB")==0) { fscanf(fp1,"%s",&operand); op=atoi(operand); lc=lc+op; } else if(strcmp(opcode,"BYTE")==0) { fscanf(fp1,"%s",&operand); f=strlen(operand); lc=lc+(f-3); } else if(strcmp(opcode,"WORD")==0) { fscanf(fp1,"%s",&operand); lc=lc+3; } else { if(x==1) { fscanf(fp1,"%s",operand); lc=lc+3; } } } fprintf(fp2,"\n%d\t%s\t%s\t%s\n",d,lb,opcode,operand); if(symerr==1) fprintf(fp2,"\n**DUPLICATE SYMBOL**\n"); if(oper==1) fprintf(fp2,"\n**INVALID OPERATION CODE**\n"); fscanf(fp1,"%s\t%s",&lb,&opcode); symerr=0; oper=0; } p1=lc-sa; fprintf(fp2,"\nThe program length is %d",p1); printf("\n symbol table\tlabeL address\n"); for(q=1;q<j;q++) printf("\n%s\t%d",s[q].sn,s[q].add); fcloseall(); getch(); }
#include#include#includevoid main(){char opcode[10],operand[10],label[10],code[10][10],ch;char mnemonic[10][10]={"START","LDA","STA","LDCH","STCH","END"};int locctr,start,len,i=0,j=0;FILE *fp1,*fp2,*fp3;clrscr();fp1=fopen("INPUT.DAT","r");fp2=fopen("SYMTAB.DAT","w");fp3=fopen("OUT.DAT","w");fscanf(fp1,"%s%s%s",label,opcode,operand);if(strcmp(opcode,"START")==0){start=atoi(operand);locctr=start;fprintf(fp3,"%s\t%s\t%s\n",label,opcode,operand);fscanf(fp1,"%s%s%s",label,opcode,operand);}elselocctr=0;while(strcmp(opcode,"END")!=0){fprintf(fp3,"%d",locctr);if(strcmp(label,"**")!=0)fprintf(fp2,"%s\t%d\n",label,locctr);strcpy(code[i],mnemonic[j]);while(strcmp(mnemonic[j],"END")!=0){if(strcmp(opcode,mnemonic[j])==0){locctr+=3;break;}strcpy(code[i],mnemonic[j]);j++;}if(strcmp(opcode,"WORD")==0)locctr+=3;else if(strcmp(opcode,"RESW")==0)locctr+=(3*(atoi(operand)));else if(strcmp(opcode,"RESB")==0)locctr+=(atoi(operand));else if(strcmp(opcode,"BYTE")==0)++locctr;fprintf(fp3,"\t%s\t%s\t%s\n",label,opcode,operand);fscanf(fp1,"%s%s%s",label,opcode,operand);}fprintf(fp3,"%d\t%s\t%s\t%s\n",locctr,label,opcode,operand);fcloseall();printf("\n\nThe contents of Input Table :\n\n");fp1=fopen("INPUT.DAT","r");ch=fgetc(fp1);while(ch!=EOF){printf("%c",ch);ch=fgetc(fp1);}printf("\n\nThe contents of Output Table :\n\n\t");fp3=fopen("OUT.DAT","r");ch=fgetc(fp3);while(ch!=EOF){printf("%c",ch);ch=fgetc(fp3);}len=locctr-start;printf("\nThe length of the program is %d.\n\n",len);printf("\n\nThe contents of Symbol Table :\n\n");fp2=fopen("SYMTAB.DAT","r");ch=fgetc(fp2);while(ch!=EOF){printf("%c",ch);ch=fgetc(fp2);}fcloseall();getch();}INPUT FILE:INPUT.DAT** START 2000** LDA FIVE** STA ALPHA** LDCH CHARZ** STCH C1ALPHA RESW 1FIVE WORD 5CHARZ BYTE C'Z'C1 RESB 1** END **-Fabianski Benjamin
#include<stdio.h> #include<conio.h> #include<string.h> #include<stdlib.h> struct object_code { int locctr; char add[10]; }obcode[300]; void main() { char input[100][16],output[100][16],binary[20],address[20],stloc[10]; int len,bitmask,loc,tlen=0,tloc,textloc,i=0,location,j,k,count=0,start,n,num=0,inc=0; FILE *fp1,*fp2; clrscr(); fp1=fopen("linput.dat","r"); fp2=fopen("reloadout.dat","w"); printf("Enter the location where the program has to be loaded:"); scanf("%s",stloc); start=atoi(stloc); location=start; tloc=start; fscanf(fp1,"%s",input[i]); while(strcmp(input[i],"T")!=0) { strcpy(output[i],input[i]); i++; fscanf(fp1,"%s",input[i]); strcpy(output[i],input[i]); } itoa(start,output[2],10); while(strcmp(input[i],"E")!=0) { strcpy(output[i],input[i]); if(strcmp(input[i],"T")==0) { for(j=0;j<3;j++) { i++; fscanf(fp1,"%s",input[i]); strcpy(output[i],input[i]); } bitmask=atoi(output[i]); itoa(bitmask,binary,2); strcpy(output[i],NULL); textloc=atoi(output[i-2]); textloc=textloc+start; itoa(textloc,output[i-2],10); for(n=0;n<(textloc-(tloc+tlen));n++) { strcpy(obcode[inc].add,"xx"); obcode[inc++].locctr=location++; } tlen=atoi(output[i-1]); tloc=textloc; k=0; } else { if(binary[k]==1) { num=0; len=strlen(output[i]); strcpy(address,NULL); for(j=2;j<len;j++) { address[num]=output[i][j]; output[i][j]='\0'; num++; } loc=atoi(address); loc=loc+start; itoa(loc,address,10); strcat(output[i],address); } k++; len=strlen(output[i]); num=0; for(n=0;n<len;n++) { obcode[inc].add[num++]=output[i][n]; if(num>1) { obcode[inc++].locctr=location++; num=0; } } } i++; fscanf(fp1,"%s",input[i]); } strcpy(output[i],input[i]); i++; fscanf(fp1,"%s",input[i]); loc=atoi(input[i]); loc=loc+start; strcpy(output[i],itoa(loc,address,10)); count=0; i=0; n=0; fprintf(fp2,"%d\t",obcode[n].locctr); for(n=0;n<inc;n++) { fprintf(fp2,"%s",obcode[n].add); i++; if(i>3) { fprintf(fp2,"\t"); i=0; count++; } if(count>3) { fprintf(fp2,"\n%d\t",obcode[n+1].locctr); count=0; } } getch(); }
#include<stdio.h> #include<string.h> #include<conio.h> /*Structure created for student record*/ typedef struct student { int roll_no; char name[30]; }student; void copy(char [],char []); /*Function to create or insert the records In write mode it creates new file and write the records In append mode it insert the records in already created file */ void create(char mode[]) { student stud; FILE *fp; int total,i; fp=fopen("Records.txt",mode); if(fp==NULL) printf("\nUnable to open the file"); else { printf("\nHow many record(s) do you want to enter\t"); scanf("%d",&total); for(i=0;i<total;i++) { printf("Enter the roll no and name\t"); scanf("%d %s",&stud.roll_no,stud.name); fprintf(fp,"\n\t%d \t%s",stud.roll_no,stud.name); } printf("\nRecord(s) inserted successfully..."); fclose(fp); } } /*This function displays the record of file passed to it using fread and fwrite*/ void display(char filename[]) { student stud; FILE *fp; fp=fopen(filename,"r+"); if(fp==NULL) printf("\nUnable to to open file"); else { while(fscanf(fp,"\n\t%d \t%s",&stud.roll_no,stud.name)!=EOF) { printf("\n%d\t%s",stud.roll_no,stud.name); } } fclose(fp); } /*Function to search the records It returns -1 if search is unsuccessful else return 0*/ int search(int roll) { student stud; FILE *fp; fp=fopen("Records.txt","r+"); if(fp==NULL) printf("\nUnable to to open file"); else { while(fscanf(fp,"\n\t%d \t%s",&stud.roll_no,stud.name)!=EOF) { if(roll 0) printf("\n\tREnamed...\n\n"); //fclose(fp1); printf("\n\nRecords deleted successfully..."); } else printf("\nOops! Record not found..."); } } /*Function to copy all records from one file to other*/ void copy(char f1[],char f2[]) { student stud; FILE *fp1,*fp2; fp1=fopen(f1,"r+"); fp2=fopen(f2,"w+"); if(fp1==NULL fp2==NULL) printf("\nUnable to to open file"); else { while(fscanf(fp1,"\n\t%d \t%s",&stud.roll_no,stud.name)!=EOF) { fprintf(fp2,"\n\t%d \t%s",stud.roll_no,stud.name); } fclose(fp1); fclose(fp2); printf("\n\nRecords copied successfully..."); printf("\nContents are...\n"); display(f2); } } FILE *fp; /*Main function starts*/ void main() { int ch,i,roll; //if(!(fp=fopen("record.txt","r+"))) //fp=fopen("Record.txt","w+"); do { clrscr(); /*Menu for the function*/ printf("\n*** MENU ***"); printf("\n1.Create"); printf("\n2.Insert"); printf("\n3.Update"); printf("\n4.Search"); printf("\n5.Display"); printf("\n6.Copy"); printf("\n7.Delete"); printf("\n8.Exit"); printf("\nEnter your choice\t"); scanf("%d",&ch); switch(ch) { case 1:create("w+");break; case 2:create("a+");break; case 3:modify();break; case 4: printf("\nEnter the roll no to be searched\t"); scanf("%d",&roll); i=search(roll); if(i==-1) printf("\nOops! Record not found"); break; case 5:display("Records.txt");break; case 6:copy("Records.txt","Newcopy.txt");break; case 7:Delete();break; case 8:break; default:printf("\nPlease enter proper choice..."); } getch(); }while(ch!=8); /*Program terminates on choice 8*/ } Written by: Fabianski Benjamin
C1: Core Mathematics 1: 6663 C2: Core Mathematics 2: 6664 C3: Core Mathematics 3: 6665 C4: Core Mathematics 4: 6666 FP1: Further Pure Mathematics 1: 6667 FP2: Further Pure Mathematics 2: 6668 FP3: Further Pure Mathematics 3: 6669 M1: Mechanics 1: 6677 M2: Mechanics 1: 6678 M3: Mechanics 1: 6679 M4: Mechanics 1: 6680 M5: Mechanics 1: 6681 S1: Statistics 1: 6683 S2: Statistics 2: 6684 S3: Statistics 3: 6691 S4: Statistics 4: 6686 D1: Decision Mathematics 1: 6689 D2: Decision Mathematics 2: 6690 Three are needed for AS and another three for A2. But there are restrictions on the combinations that you may take. For more details look at the attached link.
#include<stdio.h> #include<string.h> #include<stdlib.h> struct node { int n; struct node *ptr; }; int main(void) { struct node *n1,*strt,*temp; char a; int cnt=0,i=0; //char a[50],temp[100],line[100],word[50],e[50],final[100]; //FILE *fp,*fp1,*fp2; strt=malloc(sizeof(struct node)); strt->n=90; strt->ptr=NULL; for(a='y';a!='n';) { n1=malloc(sizeof(struct node)); n1->n=++cnt; n1->ptr=strt; strt=n1; scanf("%c",&a); } // ptr[1]=40; // ptr[2]=30; n1=strt; while(n1!=NULL) { printf("\n %d at loc %p",n1->n,n1); printf(" locaa %p \n",n1->ptr); n1=n1->ptr; } return 0; } ~ ~ ~