VC++ (ifstatement.cpp):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | //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判斷語句的使用
沒有留言:
張貼留言