Ejemplo n.º 1
0
Archivo: main.c Proyecto: cipow/hello-c
int main()
{
    mahasiswa dataMhs[100];
    puts("\t\tPAP-11");
    puts("\t\t------\n");
    dataMhs[0]=makeMhs("AP5C","M.AFIFUDIN",makeDate(18,9,1997),3.7);
    dataMhs[1]=makeMhs("AP4A","CIPOWELA",makeDate(8,2,1998),3);
    dataMhs[2]=makeMhs("AP9D","NOVALA",makeDate(10,5,1990),3.5);
    dataMhs[3]=makeMhs("APNN","P.E.K.K.A",makeDate(20,10,1997),3.8);
    dataMhs[4]=makeMhs("CIPO","WELAHAN",makeDate(8,8,1998),3.8);
    puts("List Mahasiswa");
    listAllMhs(dataMhs);
    puts("\nList Mahasiswa IPK < 3.5");
    listByIPK(dataMhs,'<',3.5);
    puts("\nList Mahasiswa IPK > 3.4");
    listByIPK(dataMhs,'>',3.4);
    puts("\nList Mahasiswa IPK = 3.8");
    listByIPK(dataMhs,'=',3.8);
    puts("\nSorting Nama");
    mhssortByName(dataMhs);
    listAllMhs(dataMhs);
    puts("\nSorting IPK");
    mhssortByIPK(dataMhs);
    listAllMhs(dataMhs);
    puts("\nCari NIM CIPO");
    findMhsByNIM(dataMhs,"CIPO");
    puts("\nCari NIM PIPO");
    findMhsByNIM(dataMhs,"PIPO");
    return 0;
}
Ejemplo n.º 2
0
//----------------------------------------------
// SECTION 1: THE PRODUCT DEFINITION SECTION (PDS)
//----------------------------------------------
bool GribV1Record::readGribSection1_PDS(ZUFILE* file) {
    fileOffset1 = zu_tell(file);
    if (zu_read(file, data1, 28) != 28) {
        ok=false;
        eof = true;
        return false;
    }
    sectionSize1 = makeInt3(data1[0],data1[1],data1[2]);
    tableVersion = data1[3];
    idCenter = data1[4];
    idModel  = data1[5];
    idGrid   = data1[6];
    hasGDS = (data1[7]&128)!=0;
    hasBMS = (data1[7]&64)!=0;

    dataTypeV1 = data1[8];	 // octet 9 = parameters and units
    /* convert data type */
    dataType=GRBV1_TO_DATA[dataTypeV1];
    levelTypeV1 = data1[9];
    /* convert level type */
    levelType=GRBV1_TO_DATA_LV[levelTypeV1];
    levelValue = makeInt2(data1[10],data1[11]);

    refYear   = (data1[24]-1)*100+data1[12];
    refMonth  = data1[13];
    refDay    = data1[14];
    refHour   = data1[15];
    refMinute = data1[16];

    refDate = makeDate(refYear,refMonth,refDay,refHour,refMinute,0);

    periodP1  = data1[18];
    periodP2  = data1[19];
    timeRange = data1[20];
    periodsec = periodSeconds(data1[17],data1[18],data1[19],timeRange);
    if(periodP2 > periodP1)
        deltaPeriod=periodP2-periodP1;
    //qWarning() << "Periodsec:" << periodP2-periodP1 << " - comp= " << periodsec;
    curDate = makeDate(refYear,refMonth,refDay,refHour,refMinute,periodsec);

//if (dataType == GRB_PRECIP_TOT) printf("P1=%d p2=%d\n", periodP1,periodP2);

    int decim;
    decim = (int)(((((zuint)data1[26]&0x7F)<<8)+(zuint)data1[27])&0x7FFF);
    if (data1[26]&0x80)
        decim *= -1;
    decimalFactorD = pow(10.0, decim);

    // Controls
    if (! hasGDS) {
        //erreur("Record: GDS not found");
        ok = false;
    }
    if (decimalFactorD == 0) {
        //erreur("Record: decimalFactorD null");
        ok = false;
    }
    return ok;
}
Ejemplo n.º 3
0
void			Logger::logError(const char *msg)
{
	char		*date = NULL;

	date = makeDate();
	std::cerr << "ERROR: " << date << " : " << msg << std::endl;
	delete[] (date);
}
Ejemplo n.º 4
0
void			Logger::logInfo(const std::ostringstream& msg)
{
	char		*date = NULL;

	date = makeDate();
	std::cout << "INFO: " << date << " : " << msg.str() << std::endl;
	delete[] (date);
}
Ejemplo n.º 5
0
void			Logger::logInfo(const char *msg)
{
	char		*date = NULL;

	date = makeDate();
	std::cout << "INFO: " << date << " : " << msg << std::endl;
	delete[] (date);
}
Ejemplo n.º 6
0
void			Logger::logDebug(const std::ostringstream& msg)
{
#ifdef DEBUG
	char		*date = NULL;

	date = makeDate();
	std::cout << "DEBUG: " << date << " : " << msg.str() << std::endl;
	delete[] (date);
#endif
}
Ejemplo n.º 7
0
void			Logger::logDebug(const char *msg)
{
#ifdef DEBUG
	char		*date = NULL;

	date = makeDate();
	std::cout << "DEBUG: " << date << " : " << msg << std::endl;
	delete[] (date);
#endif
}
Ejemplo n.º 8
0
void PDBHeader::dump()
{
    char buf[5];
    
    qDebug("PDB Header:\n");
    qDebug("Name [%s]", name);
    qDebug("Attributes %x", attributes);
    qDebug("Version %x", version);
    qDebug("Create date %s", makeDate(create_date).toAscii().data());
    qDebug("Mod date %s", makeDate(mod_date).toAscii().data());
    qDebug("Backup date %s", makeDate(backup_date).toAscii().data());
    qDebug("Mod number %d", mod_number);
    qDebug("appInfoID %d", appInfoID);
    qDebug("sortInfoID %d", sortInfoID);
    fromCC(type, buf);
    qDebug("Type %s", buf);
    fromCC(creator, buf);
    qDebug("Creator %s", buf);
    qDebug("Unique ID seed %d", uniqueIDseed);
    qDebug("Number of records %d", num_records);
}
Ejemplo n.º 9
0
QDate
FirebirdColumn::getDate()
{
    if (isNull()) return QDate();
    struct tm tm;

    switch (_var->sqltype & ~1) {
    case SQL_TYPE_DATE:
	_procs->isc_decode_sql_date((ISC_DATE*)_var->sqldata, &tm);
	return makeDate(&tm);
    default:
	break;
    }

    qWarning("Sqlda::getDate: invalid type: %d", _var->sqltype);
    return QDate();
}
Ejemplo n.º 10
0
QDate
makeDate(time_t time)
{
    return makeDate(localtime(&time));
}
Ejemplo n.º 11
0
 openstudio::Date YearDescription_Impl::makeDate(unsigned monthOfYear, unsigned dayOfMonth)
 {
   return makeDate(openstudio::MonthOfYear(monthOfYear), dayOfMonth);
 }