兩個好玩的C語言程式
同學考我的一道題。
1.寫一個c語言程式,輸出hello,刪掉程式碼的第一個字元,輸出world。
2.寫一個c語言程式,輸出hello,刪掉程式碼的最後一個字元,輸出world。
想了一會,寫出了這兩個程式碼,哈哈,再次膜拜一下c語言的語法。
Think time
。
。
。
。
。
。
//* #define CQSB //*/ #include<stdio.h> int main() { int a=0; #ifdef CQSB puts("hello"); a=1; #endif if(!a) puts("world"); return 0; }
#include<stdio.h>
#define pp main(){puts("hello");}
#define p main(){puts("world");}
pp
相關推薦
100個經典C語言程式(益智類)
100個經典C語言程式(益智類) 【1.繪製餘弦曲線】 在螢幕上用“*”顯示0~360度的餘弦函式cos(x)曲線 [問題分析與演算法設計] 利用cos(x)的左右對稱性,將螢幕的行方向定義為x,列方向定義為y,則0~180度的圖形與180~360度的圖形是左右對稱的,
[轉]100個經典C語言程式(益智類問題)
目錄: 1.繪製餘弦曲線 2.繪製餘弦曲線和直線 3.繪製圓 4.歌星大獎賽 5.求最大數 6.高次方數的尾數 8.借書方案知多少 9.楊輝三角形 10.數制轉換 11.打魚還是晒網 12.抓交通肇事犯 13.該存多少錢 14.怎樣存錢利最大
兩個好玩的C語言程式
同學考我的一道題。 1.寫一個c語言程式,輸出hello,刪掉程式碼的第一個字元,輸出world。 2.寫一個c語言程式,輸出hello,刪掉程式碼的最後一個字元,輸出world。 想了一會,寫出了這兩個程式碼,哈哈,再次膜拜一下c語言的語法。 Think time 。
B00007 快速模冪運算的兩個C語言程式
這兩段程式碼都不是大整數計算的程式,是2進位制64整數的計算程式,資料不能大於2進位制63位。兩段程式碼分別如下: uint64_t mul_mod(uint64_t a, uint64_t b, uint64_t m) { uint64_t d = 0, mp2
閑來無事看兩個好玩的C語言面試題
當前 下午 沒有 fontsize 機器 比較 linu 需要 -s 昨天最後一天工作日,讓我碰到了兩個有意思的C語言編程問題,周末前權當輕松一下,挺有意思就過去了,因為今晚雨夜通宵,就把它們記錄了下來。 事件1:關於結構體對齊和packed屬性 下午跟同事下樓抽煙,聊
好玩的c語言程式!
執行程式後1分鐘之後關機,只有在一分鐘內輸入“我是豬”便可取消關機。#include<stdio.h> #include<stdlib.h> #include<string
C語言程式例項100個
include "dos.h" main() { FILE *fp; structdate d; float sum,chm=0.0; int len,i,j=0; int c; charch[4]="",ch1[16]="",chtime[12]="",chshop[16],chmone
統計字符串單詞數的兩種方法(c語言實現)
字符串長度 字符 include ++ hit you 問題 code bool 問題描述:統計一個字符串,字符串由單詞,空格構成。 思路: 一,遍歷字符串所有字符,設置一個布爾變量來判斷當前是空格還是字母 1 #include <stdio
c語言程式求一元二次方程
#include<stdio.h> #include<math.h> void main() { float a ,b ,c ,d ,e ,f ,x1 ,x2; printf("請輸入a:"); scanf("%f",&a); printf("請輸入b:"); sca
VS2017使用方法 編寫C語言程式"Hello World"
本文介紹用Microsoft Visual Studio 2017建立一個C語言程式的具體步驟。 Step1:開啟Microsoft Visual Studio 2017 Step2:新建Project ①檔案→新建→專案 ②選擇Visual C++ → 空專
C語言入門 2 安裝VS2013開發環境並編寫第一個C語言程式
分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!  
Mac上編寫C語言程式
基礎知識: 一、mac開啟終端:1、點選mac右上角的搜尋圖示 -> 2、搜尋“terminal.app” -> 按enter鍵開啟終端 二、終端命令:新建檔名(mkdir 資料夾名);列出資料夾下列表(ls); 刪除命令(rm 檔名/資料夾) 三、進入資
Ubuntu下GDB除錯C語言程式
轉自:http://zhgeaits.me/other/2013/03/17/gdb-study-notes.html,感謝博主。 1.GDB是什麼 GDB是GNU開源組織釋出的一個UNIX下的程式除錯工具,專門用來除錯C,C++這些程式的了,而且都是命令列模式的。 2.準備工作 平
leetcode 2. 兩數相加 C語言版
struct ListNode* addTwoNumbers(struct ListNode* l1, struct ListNode* l2) { struct ListNode* l = (struct ListNode*)malloc(sizeof(struct ListNode));
leetcode 1. 兩數之和 C語言版
首先是直接暴力法: 時間複雜度為O(n2),空間複雜度為O(1): int* twoSum(int* nums, int numsSize, int target) { int* a = (int*)malloc(sizeof(int) * 2); int i,j;
leetcode 19. 刪除連結串列的倒數第N個節點 C語言版
給定一個連結串列,刪除連結串列的倒數第 n 個節點,並且返回連結串列的頭結點。 示例: 給定一個連結串列: 1->2->3->4->5, 和 n = 2. 當刪除了倒數第二個節點後,連結串列變為 1->2->3->5. 這個
程式設計菜鳥到大佬之路:C語言程式(十二)
第十二天學習精要 遞迴初步 遞迴 一個函式,自己呼叫自己,就是遞迴。 # include <iostream> using namespace std; int factorial(int n) // 函式返回n的階乘 { if (n ==
如何在C語言程式中統計輸入漢字的個數
C中的漢字用“機內碼”,一個漢字兩位元組,最高位都是1,所以可以用下列程式碼求得一個字串裡漢字的個數: #include<stdio.h> #include<string.h> int main() { char s[1000]; int cn,i,all; whil
SVM的兩個引數 C 和 gamma的解析
轉載於:https://blog.csdn.net/lujiandong1/article/details/46386201 SVM模型有兩個非常重要的引數C與gamma。其中 C是懲罰係數,即對誤差的寬容度。c越高,說明越不能容忍出現誤差,容易過擬合。C越小,容易欠擬合。C過大或過小,泛化能力
c 語言程式關機
學習了這麼長的c語言,天天敲程式碼也許會有點枯燥;今天學習一下用一段簡單的程式碼惡搞別人; system("shutdown -s -t 50") 對,它就是今天主角。別小看它 ,它可以讓別人電腦關機。 程式碼如下: #include<stdio.h> #inc