Show toolbar

2014年7月2日 星期三

If...else...statements

標題:if else 判斷語句
VC++ (ifstatement.cpp):
//Chapter 1 - if statement
#include <iostream>
#include <string>
using namespace std;

int main(void)
{
    int len = 0;
    string footballer = "";
    
    cout << "Input Name:";
    cin  >> footballer;

    len = footballer.length();

    if(len != 0 && len <= 10) {
        cout << footballer << endl;
    } else {
        cout << "Word length of less than 10" << endl;
    }
    
    system("pause");
    return 0;
}

說明:
基本if else判斷語句的使用

沒有留言:

張貼留言