17
十二月

程式設計一程式 12/17: Quiz2

   Posted by: admin   in 103(上)程式設計(一)

#include 
 #include <stdio.h>
int main(int argc, char *argv[])
{
    int i, P;
    int H, M, h, m, S, D, Total;
    FILE* fin;
 
    fin = fopen("q2.txt", "r");
 
    fscanf(fin, "%d\n", &P);
    for (i=0; i<P; i++)
    {
        fscanf(fin, "%d %d %d %d %d %d\n",
         &H, &M, &h, &m, &S, &D);
         if (m > M)
            Total = (h -H + 1) * S * D;
         else
            Total = (h -H) * S * D;
        printf("%d\n", Total);
    }
    fclose(fin);
    return 0;
} }}

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

Tags: , ,

This entry was posted on 星期三, 十二月 17th, 2014 at 09:35:28 and is filed under 103(上)程式設計(一). You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a reply

Name (*)
Mail (will not be published) (*)
URI
Comment