中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

數學和編程到底是什么關系?

發布時間:2020-08-03 16:28:47 來源:網絡 閱讀:435 作者:Allen5G 欄目:編程語言

不知道什么時候開始,數學和編程被捆綁到了一起,數學不好學編程也不行,很多人的意識數學系畢業的學編程一定厲害。

只能說,確實多慮了,至于數學好就編程好更是想多了,兩者也是沒有絕對的關系,基本的加減乘除已經可以應付絕大多數的場景了。

這時候大家會說算法都是數學構成的啊,滿滿的都是數學元素。
我從大一就開始接觸編程,到現在畢業兩年,既在大型國企做過飛控算法,也在世界500強外企做過通信算法開發,真的沒有那么多算法用你去開發,所謂的算法落實到個人就是邏輯,就是業務,你要用的算法基本都是現成的,直接用就好了,別太擔心。

首先說些我自己數學一般水平,高中還算喜歡,也比較擅長,但是到了大學基本就是隨波逐流了,基本都是擦邊過那種。

大一學習VB

這個時候學習的vb,做了個項目是一個微型的微博管理系統,主要功能就是界面可以點擊登錄,輸入密碼登錄后就可以瀏覽圖片,添加刪除管理日志,還可以自定義背景圖片等,時間有點久,大致功能就這些,整個項目和數學沒有任何關系,是的,沒有任何,這時候甚至高數都還沒學完,主要的難度都是邏輯上,要設計什么功能等,VB的編程也是模塊式開發,基本的控件都是現成的,只需要添加想要的邏輯就可以。

舉個當時寫的判斷閏年的例子

Private Sub Form_Click()

    Dim y%

    y = InputBox("y=")

If y Mod 400 = 0 Then

        Print "是閏年"

    Else

        If y Mod 100 = 0 Then

            Print "不是閏年"

        Else

   If y Mod 4 <> 0 Then

                Print "不是閏年"

            Else

           Print "是閏年"

           End If

  End If

End If

End Sub
同理,學習C語言

C語言相較于VB確實難度提升了很多,但是基本的功能實現也只是加減乘除罷了,我大學之后幾年一直是在做嵌入式相關,主要涉及的語言就是C語言,代碼行數確實很多,但是和數學關系不大。
大部分的代碼都是邏輯代碼,也就是if else,這也就是為什么說if else 就完成了基本的代碼,至于算法絕大多數都被封裝好了,直接調用就好。

下邊給大家看一個搖搖棒的項目,看著還挺復雜,實際分析下還是基礎的邏輯構成。一直想強調的就是邏輯很重要,別自己嚇自己,真不是數學的鍋。

#include
#define uchar unsigned char
#define uint unsigned int

sbit key = P3^0;//定義切換畫面開關
uchar Key_num;//定義按鍵次數
uchar Int0_num=0;//定義中斷次數
uchar Direction;//定義搖動方向(從左到右)
uchar code Embed[]={
0x40,0x00,0x20,0x00,0xd0,0x3f,0x4c,0x40,0x43,0x40,0x44,0x42,0x48,0x44,0xd8,0x43,
0x30,0x78,0x10,0x00,0x00,0x00,0xfc,0x07,0x00,0x20,0x00,0x40,0xff,0x3f,0x00,0x00,

0x20,0x21,0x24,0x11,0x2c,0x4d,0x35,0x81,0xe6,0x7f,0x34,0x05,0x2c,0x59,0x24,0x21,
0x00,0x18,0xfc,0x07,0x24,0x00,0x24,0x00,0xe2,0xff,0x22,0x00,0x22,0x00,0x00,0x00,

0x00,0x00,0x10,0x82,0x0c,0x82,0x04,0x42,0x4c,0x42,0xb4,0x23,0x94,0x12,0x05,0x0a,
0xf6,0x07,0x04,0x0a,0x04,0x12,0x04,0xe2,0x14,0x42,0x0c,0x02,0x04,0x02,0x00,0x00,

0x02,0x08,0xfa,0x08,0x82,0x04,0x82,0x24,0xfe,0x40,0x80,0x3f,0x40,0x22,0x60,0x2c,
0x58,0x21,0x46,0x2e,0x48,0x20,0x50,0x30,0x20,0x2c,0x20,0x23,0x20,0x20,0x00,0x00,

0x00,0x40,0x10,0x40,0x2c,0x48,0x24,0x49,0xa4,0x49,0x64,0x49,0x25,0x49,0x26,0x7f,
0x24,0x49,0x24,0x49,0xa4,0x49,0x24,0x4b,0x34,0x48,0x2c,0x40,0x04,0x40,0x00,0x00,
};
uchar code love[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x3F,0x00,0x20,0x00,0x20,0x00,0x20,
0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x0F,
0x04,0x10,0x02,0x20,0x02,0x20,0x02,0x20,0x02,0x20,0x04,0x10,0xF8,0x0F,0x00,0x00,
0x00,0x00,0x00,0x00,0xFE,0x07,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x20,0x00,0x10,
0x00,0x08,0xFE,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x3F,0x82,0x20,0x82,0x20,
0x82,0x20,0x82,0x20,0x82,0x20,0x82,0x20,0x82,0x20,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};

uchar code love_picture[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x78,0x00,0xFC,0x00,0xFE,0x01,0xFE,0x03,0xFE,0x07,0xFE,0x0F,0xFE,0x1F,0xFC,0x3F,
0xF8,0x7F,0xFC,0x3F,0xFE,0x1F,0xFE,0x0F,0xFE,0x07,0xFE,0x03,0xFE,0x01,0xFC,0x00,
0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};

uchar code Hello[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

0x08,0x20,0xF8,0x3F,0x08,0x21,0x00,0x01,0x00,0x01,0x08,0x21,0xF8,0x3F,0x08,0x20,

0x00,0x00,0x00,0x1F,0x80,0x22,0x80,0x22,0x80,0x22,0x80,0x22,0x00,0x13,0x00,0x00,

0x00,0x00,0x08,0x20,0x08,0x20,0xF8,0x3F,0x00,0x20,0x00,0x20,0x00,0x00,0x00,0x00,

0x00,0x00,0x08,0x20,0x08,0x20,0xF8,0x3F,0x00,0x20,0x00,0x20,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x1F,0x80,0x20,0x80,0x20,0x80,0x20,0x80,0x20,0x00,0x1F,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x33,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,

0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

};

uchar code Smile[] = 
{
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0xF0,0x1F,0x3C,0x3C,0x0E,0xF7,0x06,0xEF,0xF3,0xDC,0xF3,0xB0,0x63,0xB0,0x03,0xB0,
  0xF3,0xB0,0xF3,0xB8,0x03,0xDD,0x06,0xEF,0x0E,0x76,0x3C,0x3C,0xF8,0x1F,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};   

uchar code Hxembed_Make[]={
0x02,0x01,0xf2,0x03,0x12,0x41,0x12,0x81,0x1e,0x7f,0x00,0x00,0x80,0x00,0x80,0x40,
0xff,0xff,0xa0,0x40,0x90,0x23,0x88,0x0c,0x86,0x10,0x84,0x60,0x80,0x20,0x00,0x00,
0x80,0x00,0x80,0x40,0x80,0x30,0x80,0x0c,0xfe,0x03,0x82,0x00,0x8a,0x00,0x92,0x00,
0xf2,0x00,0xa2,0x20,0x82,0x40,0xfe,0x3f,0x80,0x00,0x80,0x00,0x80,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xC0,0x00,0xB8,0x1E,0xA0,0x02,0xFE,0x3F,0xA4,0x02,0x60,0x02,
0x50,0x1E,0x00,0x00,0xE0,0x03,0x00,0x00,0x14,0x60,0xEC,0x3F,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0x80,0x00,0x40,0x00,0xF0,0x3F,0x0C,0x00,0x80,0x00,0x40,0x00,
0x30,0x00,0xEE,0x7E,0x20,0x09,0x20,0x09,0x20,0x05,0x10,0x00,0x00,0x00,0x00,0x00,
};

uchar code Thanks[] =
{
//-- 謝 --
     0x40,0x00,0x42,0x00,0xCC,0x3F,0x00,0x52,0xFC,0x2B,0x56,0x12,0x55,0x4A,0x54,0x86,
     0xFE,0x7F,0x24,0x01,0x20,0x46,0x20,0x80,0xFF,0x7F,0x20,0x00,0x20,0x00,0x00,0x00,
//-- 謝 --
     0x40,0x00,0x42,0x00,0xCC,0x3F,0x00,0x52,0xFC,0x2B,0x56,0x12,0x55,0x4A,0x54,0x86,
     0xFE,0x7F,0x24,0x01,0x20,0x46,0x20,0x80,0xFF,0x7F,0x20,0x00,0x20,0x00,0x00,0x00,
//-- ! --
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C,0x10,0xFE,0x3B,
     0xFE,0x3B,0x7C,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
uchar code danpan_picture[] = {
0x7f,0xff,0x7f,0xbf,0x7f,0xcf,0x7f,0xf3,0x01,0xfc,0x7d,0xff,0x75,0xff,0x6d,0xff,
0x0d,0xff,0x5d,0xdf,0x7d,0xbf,0x01,0xc0,0x7f,0xff,0x7f,0xff,0x7f,0xff,0xff,0xff,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x78,0x00,0xFC,0x00,0xFE,0x01,0xFE,0x03,0xFE,0x07,0xFE,0x0F,0xFE,0x1F,0xFC,0x3F,
0xF8,0x7F,0xFC,0x3F,0xFE,0x1F,0xFE,0x0F,0xFE,0x07,0xFE,0x03,0xFE,0x01,0xFC,0x00,
0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x9f,0xfb,0xab,0xfb,0xb3,0xfd,0x80,0xdd,0xb3,0xd6,0x28,0xd5,0x92,0x55,0xad,0x01,
0x92,0xd5,0xab,0xd5,0x33,0xd5,0x80,0xd6,0xb3,0xdd,0xab,0xf9,0xab,0xfd,0xff,0xff,
};

void delay(uint X)
{
  uint i;
  for(i=0;i<=X;i++)
   ;
}
void delay1(uint n)
{
       uintx,y;
       for(x=0;x<120;x++)
       for(y=0;y
}
void display1()
{
 uchar i,disp;
 if(Int0_num>4 ){disp++;Int0_num=0;}
 if(disp>1)disp=0;
 delay(12000);
 for(i=0;i<48;i++)
 {   
    P0=~Embed[disp*64+i*2];
    P2=~Embed[disp*64+i*2+1];
  delay(120);//延時時間自己可以調,最好讓畫面顯示在中間
 }
}
void display2()
{ 
 uchar i;
 delay(12000);
 for(i=0;i<64;i++)
  {
  P0=~love[i*2];
 P2=~love[i*2+1];
 delay(150);
  }

}
void display3()
{
  uchar i;
   delay(12000);
 for(i=0;i<64;i++)
  {
  P0=~love_picture[i*2];
 P2=~love_picture[i*2+1];
 delay(200);
  }
}

void display4()
{
 uchar i;
 delay(12000);
 for(i=0;i<64;i++)
  {
  P0=~Hello[i*2];
 P2=~Hello[i*2+1];
 delay(120);
  }
}
void display5()
{
 uchar i;
 delay(12000);
 for(i=0;i<64;i++)
  {
  P0=~Smile[i*2];
 P2=~Smile[i*2+1];
 delay(150);
  }
}

void display6()
{
 uchar i;
 delay(12000);
 for(i=0;i<64;i++)
  {
  P0=~Hxembed_Make[i*2];
 P2=~Hxembed_Make[i*2+1];
 delay(90);
  }
}
void display7()
{
  uchar i;
  delay(12000);
 for(i=0;i<48;i++)
  {
  P0=~Thanks[i*2];
 P2=~Thanks[i*2+1];
 delay(80);
  }
}

void int0(void) interrupt 0
{
Direction=~Direction;
 if(Direction==0)
 {
 Int0_num++;//中斷次數加1
 switch(Key_num)
  {
 case 0:display1();break;
 case 1:display2();break;
 case 2:display3();break;
 case 3:display4();break;
 case 4:display5();break;
 case 5:display6();break;
 case 6:display7();break;
 default :display1();
  }
 }
}
void main(void)
{
EA=1;//開總中斷
IT0=1;//下降沿中斷
EX0=1;//啟動外部中斷0你——怒目

Key_num=0;//初始化按鍵次數為零

while(1)
{
 if(!key)
 {
 delay1(5); // 去抖,可以跟自己的電路適當選擇時間
 if(key==0)
  {
  Key_num++;
  if(Key_num>6)//如果超過切換頁面的次數就清零
   Key_num=0;
  }
 delay1(5);
 while(!key);
 }
}
}

大家要是仔細看了上邊的代碼就會發現,都是簡單的邏輯而已,你看不懂不會寫那說明你不懂業務,即使之后的工作也是這樣,絕不會是你數學不好而做不好項目,既然如此,那還擔心什么呢?好好的學習業務邏輯就好了。


數學和編程到底是什么關系?

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

建湖县| 潼南县| 永宁县| 大渡口区| 个旧市| 泸定县| 晋城| 西乌珠穆沁旗| 柞水县| 玉龙| 亳州市| 宿迁市| 定结县| 泗水县| 鹤岗市| 桑植县| 万州区| 都江堰市| 崇义县| 徐闻县| 兴隆县| 巴林右旗| 长汀县| 汝州市| 余干县| 泉州市| 中方县| 漳浦县| 新巴尔虎右旗| 揭西县| 津市市| 伊川县| 浠水县| 涞源县| 贵南县| 三门峡市| 怀柔区| 全州县| 泾源县| 柘荣县| 景洪市|