初學c++

看了兩章不到。。隨意記錄下。

#include<iostream>
#include<string>
using std::cout;
using std::endl;
double calculation(double a,double b,char op)
{switch(op){case '+': return a+b;case '-':return a-b;case '*':return a*b;case '/':return a/b;}}double num=0;double num2=0;char op='a';
int main()
{////int num=2;//cout<<test();//std::cin>>::num;//cout<<num;//std::string wenzi="hhaha";//cout<<wenzi;cout<<"不科學計算器\n請輸入兩個數字\n請輸入第一個數\n";std::cin>>::num;cout<<"請輸入第二個數\n";std::cin>>::num2;cout<<"請輸入運算符 +,-,*,/\n";std::cin>>op;cout<<"您的結果為:\n";cout<<calculation(num,num2,op);return 0;//退出這個程序
}

  其實最主要的是在群里學到了一個有意思的東西 就是?

include<string> 原來在c++里面不能直接使用string類型,后來想通,string是引用類型。。

轉載于:https://www.cnblogs.com/minCS/archive/2013/03/12/2955967.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/274329.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/274329.shtml
英文地址,請注明出處:http://en.pswp.cn/news/274329.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

從頭開始vue創建項目_我正在以設計師的身份開始一個被動的收入項目。 從頭開始。...

從頭開始vue創建項目Do you ever read an article on Medium (or elsewhere) about passive income, side projects and big money making blogs? When I read such an article it looks like it is easy to do yourself if you just put in the work. To see if that is the …

Exaple2_1(顯示轉換)

public class Example2_1{ public static void main(String arg[]){ char ca; System.out.println(""c"unicode:"(int)c); System.out.println(":"); for(int i(int)c;i<c25;i){ System.out.println(""(char)i); } }}轉載于…

英國文化影響管理風格_文化如何影響用戶體驗

英國文化影響管理風格重點 (Top highlight)The Internet makes the world a smaller place. You can make money or gain users outside of your demographic with a digital product or service easier than a physical business. But, is selling the exact same design of t…

ubuntu12.04安裝教程

第一部分&#xff1a;準備Ubuntu12.04的啟動盤 Ubuntu支持可移動盤和CDROM安裝&#xff0c;筆者選擇后者。在Ubuntu官網http://www.ubuntu.org.cn/download/desktop下載Ubuntu鏡像文件(.iso)&#xff0c;通過光盤刻錄機將該鏡像文件刻錄到一張空白CD/DVD上。 第二部分&#xff…

element ui 空格_空格是您的UI朋友。 大量使用它。

element ui 空格Originally published at marcandrew.me on July 30th, 2020.最初于 2020 年7月30日 在 marcandrew.me 上 發布 。 Ah good old White Space. One of the simplest things to add to your designs to improve both your UIs, and user experience. Let me shar…

solaris 11 vim的安裝【轉】

轉自&#xff1a;http://www.itkee.com/os/detail-4a4.html 下面是安裝方法&#xff0c;拿出來分享一下 ①下載軟件的地方&#xff1a; ftp://ftp.sunfreeware.com/pub/freeware/intel/10/ http://artfiles.org/sunfreeware.com/pub/freeware/i386/10/ vim-7.2-sol10-x86-local…

看看老外是如何理解抽象類的

下面是我翻譯的關于幫助理解抽象類的例子。 這是一個例子幫助我們理解抽象類。在我看來這是一個非常簡單的方法。讓我們一起來看看下面的代碼&#xff1a; <?php class Fruit { private $color; public function eat() { //chew } publi…

qt 設計師縮放_重新設計縮放體驗

qt 設計師縮放With the COVID-19 pandemic hitting countries across the world, a lot of people have now switched to video meetings. Be it for your official meetings, webinars, entertainment sessions — video meetings are the new normal. We saw these video mee…

安卓應用部件_設計應用程序小部件的痛苦和喜悅

安卓應用部件Some people say widgets are a thing of the past, but recently we faced a market for which this was one of the main features users were asking for. A bit of googling showed there are not a lot of useful articles covering widget design (most info…

ASP.NET MVC3中的ViewBag動態性

在MVC 3中的有一個新的ViewBag 動態特性&#xff0c;它主要是為了從Controller到view進行傳值用的&#xff0c;類似有所使用的ViewData[] 字典類。對于ViewBag是如此的強大&#xff0c;意味著你能動態的set/get 值&#xff0c;增加任何數量的的額外字段而不需要強類型的檢測。…

ux設計中的各種地圖_UX設計中的空白

ux設計中的各種地圖UX設計中的空白是什么&#xff1f; (What is white space in UX design?) This article will help you learn about white space and why it so important in UX design.本文將幫助您了解空白以及為什么空白在UX設計中如此重要。 White space is a very us…

花點時間了解消息,句柄和窗口

消息、句柄和窗口 一&#xff0c;為什么我要花時間研究這些東西 對于我個人來說我不想做碼農&#xff0c;不想只知道拖控件&#xff0c;使用控件有的時候要了解一下底層&#xff0c;不知道你們有沒有想過這樣的一個問題&#xff0c;我們在C#中使用的的event事件是怎么觸發這個事…

ux設計中的各種地圖_如何在UX設計中使用顏色

ux設計中的各種地圖Color is the mother tongue of the subconscious.顏色是潛意識的母語。 — Carl Jung—榮格 Color has more to say than meets the eye. As a building block of visual language, color highlights, guides attention, and unifies elements. In UX, co…

《Two Dozen Short Lessons in Haskell》學習(十八) - 交互式鍵盤輸入和屏幕輸出

《Two Dozen Short Lessons in Haskell》&#xff08;Copyright © 1995, 1996, 1997 by Rex Page&#xff0c;有人翻譯為Haskell二十四學時教程&#xff0c;該書如果不用于贏利&#xff0c;可以任意發布&#xff0c;但需要保留他們的copyright&#xff09;這本書是學習 Ha…

figma設計_Figma中簡單,可重復使用的設計系統

figma設計Putting together a design system may seem like an unnecessary hassle. It’s often easier to jump straight into designing things without having to worry about styles, components, or libraries. Some might even argue that when it comes to smaller pro…

WPF 關于鼠標事件和坐標

Mouse.GetPosition(window);可以在任何時間獲得相對任意元素的鼠標位置 Mouse.Capture(el);可以讓某個元素獲得所有的鼠標事件不管他應不應該的到鼠標事件 Mouse.Capture(null);解除轉載于:https://www.cnblogs.com/wangjixianyun/archive/2013/03/25/2980953.html

訪問25%無法訪問的人-如何設計可訪問性

We’re increasingly dependent on the internet and computers for everything we do — this has become starkly more obvious through the COVID19 global pandemic.我們所做的一切都越來越依賴于互聯網和計算機-通過COVID19全球大流行&#xff0c;這一點變得更加明顯。 F…

DDD:實體如何處理外部依賴

場景 修改用戶名時&#xff0c;要驗證用戶名的唯一性。 實現1 1 public class User 2 { 3   public void ChangeUsername(string newUsername) 4   { 5   //使用服務定位器獲取IUsernameUniqueService &#xff0c;執行驗證。 6   } 7 } 實現…

架構師論壇 創業_我在早期創業時作為設計師學到的東西

架構師論壇 創業For over 2 years at a young product company, I collaborated with talented engineering folks for a 0 → 1 suite of products. Here are my learnings and key takeaways. Of course, these are my views and do not represent those of my employers or …

HFileOutputFormat與TotalOrderPartitioner

最近需要為一些數據增加隨機讀的功能&#xff0c;于是采用生成HFile再bulk load進HBase的方式。 運行的時候map很快完成&#xff0c;reduce在sort階段花費時間很長&#xff0c;reducer用的是KeyValueSortReducer而且只有一個&#xff0c;這就形成了單reducer全排序的瓶頸。于是…