1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
#include "stdafx.h"
#include <iostream>
#include<Windows.h>
//#include "mainwindow.h"
using namespace std;
int main(void) {
//FreeConsole(); //makes the window invisible
double ct;// ct= how many rows in excel you want
int serialnumber;
char stringread[80];
char str[80];
char str2[80];
char str3[80];
char str4[80];
char str5[80];
char str6[80];
char str7[80];
char str8[80];
char str9[80];
char str10[80];
char str11[80];
char str12[80];
char str13[80];
char str14[80];
char str15[80];
char str16[80];
char str17[80];
char serialnumber1[80]="Serial number";
char anode1[80]="Anode 1";
char anode2[80]="Anode 2";
char anode3[80]="Anode 3";
char anode4[80]="Anode 4";
char anode5[80]="Anode 5";
char assemblylot[80]="assembly lot number";
char Capacitence[80]="capacitence";
char cathodelot[80]="cathode lot number";
char esr[80]="ESR";
char headassembly[80]="head assembly number";
char headerglassinglot[80]="Header Glassing Lot";
char leakage[80]="Leakage"; // a bunch of strings for the template
char tantalumlot[80]="Tantalum lot number";
char teflonspacer[80]="Teflon Spacer 1";
char teflonspacer2[80]="Teflon Spacer 2";
char teflonspacer3[80]="Teflon Spacer 3";
char teflonspacerlotnumber[80]="Teflon Spacer Lot number";
char serialnumbertokit[80]="Serial number to kit";
char directory[80]="category path = Root\\Kit Serial Numbers";
printf("enter serial number:\t"); // asks for serialnumber as an integer
scanf("%d",&serialnumber); //stores the value in "serialnumber"
printf("enter assembly lot number:\t");
scanf("%79s",str5); // stores whatever the user inputs to "assembly lot number" as a string
printf("enter capacitence:\t");
scanf("%79s",str6);
printf("enter Cathode Lot Number:\t");
scanf("%79s",str7);
printf("enter ESR:\t");
scanf("%79s",str8);
printf("enter Head assembly number:\t");
scanf("%79s",str9);
printf("enter header glassing lot number:\t");
scanf("%79s",str10);
printf("enter Leakage:\t");
scanf("%79s",str11);
printf("enter Tantalum lot number:\t");
scanf("%79s",str12);
printf("enter teflon spacer lot number:\t");
scanf("%79s",str16);
printf("enter Serial number to kit:\t");
scanf("%79s",str17);
FILE *outfile; // declares a pointer to a file
outfile=fopen("z:\\database\\serialnumber%d.csv","w"),serialnumber; //opens or creates(if the file doesn't already exist) a file to write to
fprintf(outfile,"%s\n",directory); //inputs all of these strings into the first row in excel
fprintf(outfile,"%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s",serialnumber1,anode1,anode2,anode3,anode4,anode5,assemblylot,Capacitence,cathodelot,esr,headassembly,headerglassinglot,leakage,tantalumlot,teflonspacer,teflonspacer2,teflonspacer3,teflonspacerlotnumber,serialnumbertokit); //inputs all of these strings into the first row in excel which generates the template
for(ct=0;ct<40;++ct){//determines number of rows for example ct<40 gives 40 rows
printf("Enter anode 1's lot number:\t");
scanf("%79s",stringread);
printf("enter anode 2's lot number:\t");
scanf("%79s",str); //loops 40 times
printf("enter anode 3's lot number:\t");
scanf("%79s",str2);
printf("enter anode 4's lot number:\t");
scanf("%79s",str3);
printf("enter anode 5's lot number:\t");
scanf("%79s",str4);
printf("enter teflon spacer 1:\t");
scanf("%79s",str13);
printf("enter teflon spacer 2:\t");
scanf("%79s",str14);
printf("enter teflon spacer 3:\t");
scanf("%79s",str15);
fprintf(outfile,"\n%d,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s",serialnumber,stringread,str,str2,str3,str4,str5,str6,str7,str8,str9,str10,str11,str12,str13,str14,str15,str16,str17);//fills in 40 cells with all of this data
serialnumber=serialnumber+1;
}
}
|