簡單程式的編寫2:統計最高成績和最低成績
以下程式的功能是從鍵盤輸入若干個學生的成績,統計出最高成績和最低成績,當輸入負數時,結束輸入。
#include<iostream.h> void main() { int str[100],i,x,max,min; for(i=0;;i++) { cout<<"please input:\n"; cin>>x; if(x<0) break; else str[i]=x; } min=str[0]; max=str[0]; while(i--) { if(max<=str[i]) max=str[i]; if(min>=str[i]) min=str[i]; } cout<<"the max:"<<max<<endl; cout<<"the min:"<<min<<endl; }
相關推薦
簡單程式的編寫2:統計最高成績和最低成績
以下程式的功能是從鍵盤輸入若干個學生的成績,統計出最高成績和最低成績,當輸入負數時,結束輸入。 #include<iostream.h> void main() { int str[100],i,x,max,min; for(i=0;;i++) { c
從鍵盤輸入若干個學生成績,統計並輸出最高成績和最低成績,當輸入負數時結束輸入。
#include<iostream> using namespace std; int main() { double a[100]; double max=0,min=100,t; int i; for(i=0;i<100;i++) {
求最高成績和最低成績的學生的信息
back 信息 tun uid col join round from clas 求最高成績和最低成績的學生的信息 select stu.stuid,stu.stuname,c.classname,co.coursenamefrom students stuleft j
演算法題2:統計字串A中長度為k的子串在字串B中出現的總次數
問題: 輸入一個正整數 k,一個字串 A和字串B,統計A中長度為k的子串在B中出現的總次數,輸出總次數。 例如:k=2, A =’abba’, B=’abbaab’,則A的長度為2 的子串有 [‘ab’,’bb’,’ba’],它們在B中出現的次數分別為2、1、1,所以輸
【c語言】寫程式編寫2-10000以內的完全數
/* 需求:寫程式編寫2-10000以內的完全數 完全數 求一個數的因子(除了這個數本身)之和等於該數本身 例如: 6的因子是1 2 3 因子和1+2+3=6 因此6是完全數 程式理解: 第一個for迴圈是遍歷2-10000之間的數 第二個for迴圈是遍歷符合條件的數字 **/ #inclu
1.9 程式運算2:邏輯運算
邏輯運算概述 邏輯運算的結果是true或false 邏輯運算子包括相等,與或非:==,&&,||,! 條件與:同時為真就為真 條件或:只要有一個為真,結果就為真 條件非:對結果取反
hadoop2.x入門:編寫mapreduce對氣象資料集求每日最高氣溫和最低氣溫
1.下載氣象資料集 我們下載國內的氣象資料,使用下面命令進行下載 wget -D --accept-regex=REGEX -P data -r -c ftp://ftp.ncdc.noaa.gov/pub/data/noaa/2017/5*
基於 SailingEase WinForm Framework 開發優秀的客戶端應用程式(2:開始搭建模組化的程式框架)
本系統文章將詳細闡述客戶端應用程式的設計理念,實現方法。 本系列文章以 SailingEase WinForm Framework 為基礎進行設計並實現,但其中的設計理念及方法,亦適用於任何型別的客戶端應用程式的設計與開發。 目錄: SailingEase W
第0周作業2:博客閱讀和思考
技術 .cn 喜歡 最大 合格 開發文檔 培訓 世界 是我 關於當初 說起來,選擇這個專業的原因和那些因為興趣愛好或是被某一個點所吸引的同學並不相同,我的理由是庸俗的,就是為了錢。高考畢業以後,根據家裏親戚的建議,以及我個人的高中學科偏好的判斷,還有一點對編程所謂
三週學會小程式第三講:服務端搭建和部署
通過第二講我們已經知道了怎麼快速搭建一個小程式客戶端,當然服務端也是必不可少的。登入驗證,內容儲存等等都離不開服務端。 本章節主要講解怎麼快速搭建一個服務端框架和免費部署。因為好多同學僅僅為了學習小程式,為此購買一個伺服器成本還是蠻高的,所以小編特此找了一種免費的服務資源提供給大家,等到你真正要部署小程式的時
java8新特性[2]:內部迭代和外部迭代(Internal vs external iteration)
Java8 增加了新的語言特性(例如 lambda 表示式和預設方法),為此 Java8 的類庫也進行了很多改進,例如從外部迭代到內部迭代的改變。 集合類庫主要依賴於外部迭代(external iteration)。Collection 實現 Iterable 介面,從而使得使用者可以依次遍歷集
【TensorFlow學習筆記】2:基本使用流程和使用檢查點,按照時間自動管理檢查點
學習《深度學習之TensorFlow》時的一些實踐。 TF的基本使用 對於分類問題的特徵X和標籤Y,分別定義tf.placeholder,這是計算圖輸入資料的入口。 對於模型中的引數(注意不是超引數),如往往是權向量w和偏置b,定義tf.Variable,並傳入初始的值
第十二週專案2 : 摩托車繼承自行車和機動車
問題及程式碼: 在下面一段類的定義中,自行車類的虛基類為車輛類,機動車類的虛基類也為車輛類,摩托車類的基類為自行車類和機動車類,類之間均為公有繼承,如圖所示。下載可執行檔案連結motorcar.exe.(1)根據上面各類間關係的描述,補全下面程式段中空缺的程式碼;(2)實現
Caffe學習筆記2:Windows下安裝和搭建caffe框架
小菜在這裡要感謝實習老師張xx,是他的無私奉獻。他把他之前安裝和搭建caffe框架的過程全部記錄下來了寫成文件了,小菜是按照他caffe學習筆記一步一步安裝的,讓小菜少走了許多彎路,不過小菜在安裝的額
JADE學習筆記2 :Agent的建立和執行
2.1 Eclipse環境中新增JADE JADE環境變數設定成功後,就可以嘗試開發Agent了。為了開發方便,將JADE平臺與Eclipse平臺繫結起來。 首先要在eclipse中新增庫。在視窗-首選項中,選擇java,展開其子項,在構建路徑—〉使用者庫中
jquery實戰2:輪播圖和滑動導航效果
.banner{width:100%;height:450px;position:relative;z-index:0;} .banner .b-img{width:100%;height:450px;position:absolute;left:0px;top:0px;}/**/ .banner
第十二週專案2:摩托車繼承自行車和機動車
問題及程式碼: #include <iostream> #include <conio.h> #include <windows.h> using namespace std; enum vehicleStaus {rest, runni
【使用CMake組織C++工程】2:CMake 常用命令和變數
前言 前面的文章介紹了一個最簡單的CMake工程,這篇文章將介紹一個稍微複雜一些的CMake工程,結合這個工程總結一下在組織一個C/C++工程時最為常用的一些CMake命令和變數。對於涉及到的命令和變數,介紹的原則是點到即止,先僅需掌握基本用法即可,讓工程跑起
SQL進價2:三值邏輯和null
not 比較 混亂 重要 括號 none query inf HERE 1、SQL中的bool類型的值有三種普通編程語言裏的布爾型只有 true 和 false 兩個值,這種邏輯體系被稱為二值邏輯。而 SQL 語言裏,除此之外還有第三個值 unknown,因此這種邏輯體系被
js基礎面試高頻面點2:Javascript中undefined和not defined有什麽區別?
eight 對象的引用 mage 正常的 意思 bool 布爾 rip comment 二、Javascript中undefined和not defined有什麽區別? 一句話:udefined為變量正常的數據類型,不是報錯,而not defined是指變量沒有定義,