Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C ¶Á100¸öÊýµ½Êý×é

 #include <stdio.h>
#define MAX 100
int a[MAX], b[MAX], count = 0;
void rData()
{ int i;
FILE *fp;
fp = fopen("C:\\100.dat", "r");
for (i=0; i<MAX; i++)
fscanf(fp, "%d,", &a[i]);
fclose(fp);
}
 
void main()
{ int i;
rData();
//printf("Âú×ãÌõ¼þµÄÊý=%d\n", count);
for (i=0; i<MAX; i++)
printf("%d\n ", a[i]);
printf("\n");
}
²Î¿¼£º
ÒÑÖªÊý¾ÝÎļþIN.datÖдæÓÐ200¸öËÄλÊý£¬²¢Òѵ÷ÓöÁº¯ÊýrData()°ÑÕâЩÊý´æÈëÊý×éaÖУ¬Çë±àдº¯ÊýspellNum()£¬Æä¹¦ÄÜÊÇ£º°Ñ¸öλÊý×ÖºÍǧλÊý×ÖÖØÐÂ×é³ÉÒ»¸öеĶþλÊý£¨Ð¶þλÊýµÄʮλÊý×ÖÊÇÔ­ËÄλÊýµÄ¸öλÊý×Ö£¬Ð¶þλÊýµÄ¸öλÊý×ÖÊÇÔ­ËÄλÊýµÄǧλÊý×Ö£©£¬ÒÔ¼°°Ñ°ÙλÊý×ÖºÍʮλÊý×Ö×é³ÉÁíÒ»¸öеĶþλÊý£¨Ð¶þλÊýµÄʮλÊý×ÖÊÇÔ­ËÄλÊýµÄ°ÙλÊý×Ö£¬Ð¶þλÊýµÄ¸öλÊý×ÖÊÇÔ­ËÄλÊýµÄʮλÊý×Ö£©£¬Èç¹ûÐÂ×é³ÉµÄÁ½¸ö¶þλÊýÒ»¸öÊÇÆæÊý£¬ÁíÒ»¸öΪżÊý£¬²¢ÇÒÁ½¸ö¶þλÊýÖÐÖÁÉÙÓÐÒ»¸öÊýÄܱ»17Õû³ý£¬Í¬Ê±Á½¸öÐÂÊýµÄʮλÊý×Ö¾ù²»Îª0£¬Ôò½«Âú×ã´ËÌõ¼þµÄËÄλÊý°´´Ó´óµ½Ð¡µÄ˳Ðò´æÈëÊý×ébÖУ¬²¢Òª¼ÆËãÂú×ãÉÏÊöÌõ¼þµÄËÄλÊýµÄ¸öÊýcount¡£×îºómain()º¯Êýµ÷ÓÃдº¯ÊýwData()£¬°Ñ½á¹ûcountÒÔ¼°Êý×ébÖзûºÏÌõ¼þµÄËÄλÊýÊä³öµ½OUT.datÎļþÖС£
#include <stdio.h>
#define MAX 200
int a[MAX], b[MAX], count = 0;
void spellNum()
{ int i, thou, hun, ten, data, j;
int ab, cd;
for (i=0; i<200; i++)
{ thou = a[i]/1000;
hun = a[i]%1000/100;
ten = a[i]%100/10;
data = a[i]%10;
if (data==0 || hun==0)
continue;
ab = 10*data+thou;
cd = 10*hun+ten;
if ((ab-cd)%2!=0 && (ab*cd)%17==0)
{ b[count] = a[i];
count++;
}
}
for (i=0; i<count-1; i++)
for (j=i+1; j<count; j++)
if (b[i] < b[j])
{ data = b[i];
b[i] = b[j];
b[j] = data;
}
}
void rData()
{ int i;
FILE *fp;
fp = fopen("IN.dat", "r");
for (i=0; i<MAX; i++)
fscanf(fp, "%d,", &a[i]);
fclose(fp);
}
void wData()
{ FILE *fp;
int i;
fp = fopen("OUT.dat", "w");
fprintf(fp, "%d\n", count);
for (i=0; i<count; i++)
fprintf(fp, "%d\n", b[i]);
fclose(fp);
}
void main()
{ int i;
rData();
spellNum();
printf


Ïà¹ØÎĵµ£º

C/C++±à³Ì¼¼ÄÜ¡¾ÕûÀí¡¿

Ô¤´¦ÀíÆ÷£¨Preprocessor£©
1. ÓÃÔ¤´¦ÀíÖ¸Áî#define ÉùÃ÷Ò»¸ö³£Êý£¬ÓÃÒÔ±íÃ÷1ÄêÖÐÓжàÉÙÃ루ºöÂÔÈòÄêÎÊÌ⣩
#define SECONDS_PER_YEAR (60 * 60 * 24 * 365)UL
ÎÒÔÚÕâÏë¿´µ½¼¸¼þÊÂÇ飺
1). #define Óï·¨µÄ»ù±¾ÖªÊ¶£¨ÀýÈ磺²»ÄÜÒԷֺŽáÊø£¬À¨ºÅµÄʹÓ㬵ȵȣ©
2). ¶®µÃÔ¤´¦ÀíÆ÷½«ÎªÄã¼ÆËã³£Êý±í´ïʽµÄÖµ£¬Òò´Ë£¬Ö±½Ó ......

C struct ÖÐ×Ö½Ú¶ÔÆëÎÊÌâ

 VCÖÐÏÂÃæ¼¸¸ö½á¹¹Ìå´óС·Ö±ðÊǶàÉÙÄØ
struct MyStruct
{
    double m4;
    char m1;
    int  m3£»
};
s ......

ADC0809 C³ÌÐò

 #include<reg52.h>
#include<intrins.h>
#define uint  unsigned int
#define uchar unsigned char
uint date;
uchar mm=0,n=0;
uint k1,k2,k3,k4,k5,k6;
uchar code b[]={
    0x3f,0x06,0x5b,0x4f,0x66,   //0,1,2,3,4,
    0x6d,0x7d,0x07,0x7 ......

C unsigned Ó÷¨

Àý£º#define NELE(a) (sizeof(a) / sizeof(a[0]))
int main() {
char str[] = {'E', 'M', 'C'};
for (int d=-1; d<=(NELE(str)-2);d++)
      printf("%c",str[d+1]);
return 0;
}
ÅжÏprintf£¨£©Êä³öµÄÊÇʲô£¬½á¹û¿ÉÄܳöºõÒâÁÏ£¬Ê²Ã´Ò²Ã»ÓÐÊä³ö£¬Ô­ÒòÄØ£¿Ô­Òò ......

cÄÚ´æ·ÖÅä

ÄÚ´æ·ÖÅ䷽ʽÓÐÈýÖÖ£º
£¨1£© ´Ó¾²Ì¬´æ´¢ÇøÓò·ÖÅä¡£ÄÚ´æÔÚ³ÌÐò±àÒëµÄʱºò¾ÍÒѾ­·ÖÅäºÃ£¬Õâ¿éÄÚ´æÔÚ³ÌÐòµÄ
Õû¸öÔËÐÐÆÚ¼ä¶¼´æÔÚ¡£ÀýÈçÈ«¾Ö±äÁ¿£¬static ±äÁ¿¡£
£¨2£© ÔÚÕ»ÉÏ´´½¨¡£ÔÚÖ´Ðк¯Êýʱ£¬º¯ÊýÄÚ¾Ö²¿±äÁ¿µÄ´æ´¢µ¥Ôª¶¼¿ÉÒÔÔÚÕ»ÉÏ´´½¨£¬º¯
ÊýÖ´ÐнáÊøÊ±ÕâЩ´æ´¢µ¥Ôª×Ô¶¯±»ÊÍ·Å¡£Õ»ÄÚ´æ·ÖÅäÔËËãÄÚÖÃÓÚ´¦ÀíÆ÷µÄÖ¸Áî¼ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ