Çë½Ì¸ßÊÖÃǽâÒ»µÀc³ÌÐò¡£ - C/C++ / CÓïÑÔ
±àÒ»¸öc³ÌÐò,ÏȺóÊäÈëÒ»¸ö×Ö·ûºÍÒ»¸ö×Ö·û´®,ͳ¼ÆÇ°Ò»¸ö×Ö·ûÔÚ×Ö·û´®ÖгöÏֵĸöÊý¡£
ÕâÑùµÄÌâÄ¿¶¼²»×Ô¼º×ö£¬ºÎ±Øѧ±à³Ì£¿
C/C++ code:
#include <stdio.h>
#include <string.h>
int main(void)
{
char ch;
char str[100];
int count=0,i;
printf("ÊäÈëÒ»¸ö×Ö·û:");
scanf("%c",&ch);
printf("ÊäÈëÒ»¸ö×Ö·û´®:");
scanf("%s",str);
for(i=0;i<strlen(str);i++)
if(ch == str[i])
count++;
printf("×Ö·û³öÏֵĸöÊý:%d\n",count);
return 0;
}
Â¥Ö÷ÈÈ°®±à³Ì£¬Ôõô²»×Ô¼º½â¾öÕâ¸öÎÊÌâ°¡
Õâ¸ö»¹ÊÇ×Ô¼ºÐ´Ð´°É¡£¡£²»ÒªÌ«¼òµ¥¡£²»»á¾ÍºÃºÃ»ØÈ¥¿´Óï·¨Êé
2Â¥µÄ´úÂë¿ÉÒÔÊÔÊÔ£¬µ«ÔÚ
scanf("%c",&ch);
ºó¼ÓÉÏgetchar();½ÓÊջسµ×Ö·û¡£
lzÄãÌ«À×ÈËÁË¡£¡£¡£¡£¼ÓÓÍ°¡
#include <stdio.h>
#include <string.h>
#defne MAXSIZE 100
int main()
{
int i=0,num=0;
char ch,str[MAXSIZE];
//ÊäÈë×Ö·û
printf("Please input a char:");
scanf("%c",&ch);
getchar();//¹ýÂËÊäÈëµÄ»Ø³µ
//ÊäÈë×Ö·û´®
printf("Please input a string:");
gets(str);
//ÅжÏ×Ö·û³öÏֵĴÎÊý
while(i++<strlen(str))
num += (str[i]==ch?)1:0;
printf("the num is : %d\n"
Ïà¹ØÎÊ´ð£º
дÁ˸ö²âÊÔ³ÌÐòÈçÏÂ
struct hostent *hp;
char AlarmDevIP[20];
int x2;
hp = gethostbyname("www.google.com");
if (hp)
{
......
ÔÚ¸ùĿ¼/libÖдæ·ÅÒ»¸ölog.c£¬log.h£¬²¢ÓÃÏÂÃæµÄÓï¾ä£º
gcc -c log.c
ar crv liblog.a log.o
±àÒë³öÒ»¸öliblog.a¾²Ì¬¿â£¬È»ºóÔÚÎļþ¼Ð£º/testfileÖд´½¨Ò»¸ötest.cºÍtestc.c£¬test.cÖÐÒýÓÃÁËtestc.cÖж¨ÒåµÄ·½·¨ ......
ΪʲôÎҵijÌÐòµ÷ÓÃXMLÅäÖÃÎļþÖеİ¢À²®ÎÄÏÔʾ²»³öÀ´£¿ÆäËûµÄÓïÖÖ¶¼¿ÉÒÔ£¬ÈçÖÐÎÄ£¬Ó¢ÎÄ£¬µÂÎĶ¼¿É¡£
ÎÒ½«XMLµÄ±àÂë¸ÄΪutf-8ºÍunicodeµÄµ½µÃ½á¹û¶¼Ò»Ñù.
°¢À²®ÎĵÄ×Ö¿âÄãÓÐô£¿
ÓÐ,ÎÒµÄEXEÊÇ·ÅÔÚpc»úÉÏÖ´Ðе ......
visual c++2008Ëٳɰ棬²»ÄܱàÒëC³ÌÐòÂð£¿Èç¹ûÄÜÊÇÔõô¿ªÊ¼µÄ°¡£¿ÓÃËü´øµÄÃüÁîÌáʾµ¥Ôª³ýÍâ ¡£
н¨¹¤³Ì£¨¿Õ¹¤³Ì»òwin32¿ØÖÆ̨£©
¾ø¶Ô¿ÉÒÔ¡£½¨Á¢win32¿ØÖÆ̨³ÌÐò¾Í¿ÉÒÔ
ÒýÓÃ
н¨¹¤³Ì£¨¿Õ¹¤³Ì»òwin32¿ØÖÆ̨£ ......
ÈçºÎ½«Ò»¸öListBoxÖеÄÊý¾Ý´æÔÚÊý¾Ý¿âÖеÄÒ»¸ö×Ö¶ÎÏÂÃ棬²¢ÇÒÿÌõ¼Ç¼µÄ×Ö·û´®¸öÊý²»Ò»¶¨ ÒÔ¼°ÈçºÎ´ÓÊý¾Ý¿âÖжÁÈ¡¸ÃListBoxÖеÄËùÓмǼ
C/C++ code:
//´æÈëÊý¾Ý¿â
void __fastcall TForm1::Button5Click(TO ......