目前分類:C++ (22)

瀏覽方式: 標題列表 簡短摘要

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
  int a=3,b=5,c,d;

霄狼一哥 發表在 痞客邦 留言(0) 人氣()

#include<iostream>
using namespace std;
int main()
{
    int a;
    for(a=1;a<=9;cout<<"NOPQRSTUVWXYZ"<<endl,a=a+1)

霄狼一哥 發表在 痞客邦 留言(0) 人氣()

#include<iostream>
#include<iomanip>           //<iomanip>為輸出格式標頭檔
using namespace std;
int main()
{
    float a;

霄狼一哥 發表在 痞客邦 留言(0) 人氣()

#include<iostream>
using namespace std;
int main()
{
   int a,b=0,c;
   cout<<"請輸入要累加的底數:";

霄狼一哥 發表在 痞客邦 留言(0) 人氣()

#include<iostream>
using namespace std;
int main()
{
    char s1='d',s2='D',g;
    do{                                          //"do"為事先敘述迴圈內容

霄狼一哥 發表在 痞客邦 留言(0) 人氣()

#include<iostream>
using namespace std;
int main()
{
   int a,b,c;
   cout<<"請輸入要累加的底數:";

霄狼一哥 發表在 痞客邦 留言(0) 人氣()

//沒加goto
#include<iostream>
using namespace std;
int main()
{
   int a;

霄狼一哥 發表在 痞客邦 留言(0) 人氣()

#include<iostream>
using namespace std;
int main()
{
char a;
cout<<"請輸入一個字母:";

霄狼一哥 發表在 痞客邦 留言(0) 人氣()

#include<iostream>
using namespace std;
int main()
{
   int a;
   cout<<"請輸入一個月份:"<<endl;

霄狼一哥 發表在 痞客邦 留言(0) 人氣()

#include<iostream>
using namespace std;
int main()
{
  double a,b;
  cout<<"請輸入您今年綜合所的金額:";

霄狼一哥 發表在 痞客邦 留言(0) 人氣()

//巢狀 if-else
#include<iostream>
using namespace std;
int main()
{
   int a,b;

霄狼一哥 發表在 痞客邦 留言(0) 人氣()

#include<iostream>
using namespace std;
int main()
{
    char a;
    cout<<"請用鍵盤輸入A:\n"<<endl;

霄狼一哥 發表在 痞客邦 留言(0) 人氣()

#include<iostream>
using namespace std;
int main()
{
   short a=0x35ca,b=0x23e6,c=0x1234;   //"0x"為16進位表示法
   cout<<"a&b="<<(a&b)<<endl;       //"&"為AND運算

霄狼一哥 發表在 痞客邦 留言(0) 人氣()

#include<iostream>
using namespace std;
int main()
{
    cout<<"int資料長度="<<sizeof(int)<<"bytes"<<endl;
    cout<<"float資料長度="<<sizeof(float)<<"bytes"<<endl;

霄狼一哥 發表在 痞客邦 留言(0) 人氣()

#include<iostream>
using namespace std;
int main()
{
    cout<<"52U ====>"<<52U<<endl;              //後面加U=uing int
    cout<<"75.35L ===>"<<75.35L<<endl;         //後面加L或l=long

霄狼一哥 發表在 痞客邦 留言(0) 人氣()

#include<iostream>
using namespace std;
int main()
{
    int a,b,c;
    cout<<"請輸入第一個整數值:";

霄狼一哥 發表在 痞客邦 留言(0) 人氣()

#include<iostream>
#include<cmath>            //cmath標頭檔為特殊運算語法,沒有寫的話無法執行pow(,)平方運算語法
using namespace std;
int main()
{
     double a,b;

霄狼一哥 發表在 痞客邦 留言(0) 人氣()

#include<iostream>
using namespace std;
int main()
{
   int a=3,b=7,c,d,e,f,g;
   c=b/a;   //除法運算

霄狼一哥 發表在 痞客邦 留言(1) 人氣()

#include<iostream>
using namespace std;
int main()
{
    int a=7;              //宣告變數後面可以直接寫入變數值或運算式
    float b=7.39;         //float可宣告變數為浮點數

霄狼一哥 發表在 痞客邦 留言(0) 人氣()

#include<iostream>
using namespace std;                   //宣告iostream標頭檔,所要使用的語法集,跟語法宣告一樣,只是比較省事
int main()
{
    int a;
    int b;

霄狼一哥 發表在 痞客邦 留言(0) 人氣()

1 2