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判斷語句的使用
沒有留言:
張貼留言