/*
练习1.1略
练习1.2.改写程序,让他返回-1.
练习1.3.编写程序,在标准的输出上打印Hello,World。
*/
#include<iostream>
int main()
{
std::cout<<"Hello,World"<<std::endl;
return 0;
}
/*
练习1.4.编写程序使用乘法运算符来打印两个数的积
练习1.5
*/
#include<iostream>
int main()
{
std::cout<<"Please input two numbers:"<<std::endl;
int v1,v2;
std::cin>>v1>>v2;
std::cout<<v1<<" * "<<v2<<" = "<<v1*v2<<std::endl;
return 0;
}
/*练习1.6.解释程序是否合法*/
std::cout<<"The sum of "<<v1;
<<" and "<<v2;
<<<" is "<<v1+v2<<std::endl;
/*
代码不合法,缺少相应的std::cout
*/

C++ Primer练习题day1的更多相关文章

  1. python练习题-day1

    1.使用while循环输入 1 2 3 4 5 6     8 9 10 count=0 while count<10: count+=1 if count==7: continue print ...

  2. C++ Primer练习题day2

    /* 1.7略 1.8 /* 指出不合法的语句: std::cout<<"/"; std::cout<<"*/ "; std::cout ...

  3. c++primer练习题

    2.7 输出地址和姓名(1 #include <iostream> using namespace std; int main() { int 距离; cout << &quo ...

  4. C/C++:多个.cpp文件包括同一个.h头文件定义方法

    本文解决multiple definition of `XX'的错误.[出于反爬虫的目的,你不是在http://blog.csdn.net/zhanh1218上看到的,肯定不是最新最全的.] 关于头文 ...

  5. C++PRIMER第五版练习题答案第一章

    C++PRIMER第五版练习题答案第一章 应该有很多小伙伴和我一样,闲来无事买了本C++的书自己啃,课后的练习题做的很揪心,这里我分享下我写的答案,希望能帮助到你,提供源码,就不跑了哈,毕竟现在是第一 ...

  6. C primer plus 练习题 第七章

    1. #include <stdio.h> #define SPACE ' ' #define NEWLINE '\n' int main() { int spaces,newlines, ...

  7. C primer plus 练习题 第六章

    16. #include <stdio.h> int main() { double remain = 100.0; ; ) { remain = remain * 0.08 + rema ...

  8. C primer plus 练习题 第五章

    1. #include <stdio.h> #define MINU 60 int main() { int minute, hour, m; printf("请输入分钟:&qu ...

  9. C primer plus 练习题 第三章

    5. #include <stdio.h> int main() { float you_sec; printf("请输入你的年龄:"); scanf("%f ...

随机推荐

  1. 全局变量异步I/O

    /*** sync_process.c ***/ #include <stdio.h> #include <signal.h> #include <unistd.h> ...

  2. Codeforces 1276C/1277F/1259F Beautiful Rectangle (构造)

    题目链接 http://codeforces.com/contest/1276/problem/C 题解 嗯,比赛结束前3min想到做法然后rush不出来了--比赛结束后又写了15min才过-- 以下 ...

  3. JAVA RPC (十) nio服务端解析

    源码地址:https://gitee.com/a1234567891/koalas-rpc 企业生产级百亿日PV高可用可拓展的RPC框架.理论上并发数量接近服务器带宽,客户端采用thrift协议,服务 ...

  4. Python学习日记(八)—— 模块一(sys、os、hashlib、random、time、RE)

    模块,用一砣代码实现了某个功能的代码集合. 类似于函数式编程和面向过程编程,函数式编程则完成一个功能,其他代码用来调用即可,提供了代码的重用性和代码间的耦合.而对于一个复杂的功能来,可能需要多个函数才 ...

  5. AtomicInteger原理

    AtomicInteger的原理 java的并发原子包里面提供了很多可以进行原子操作的类,比如: AtomicInteger AtomicBoolean AtomicLong AtomicRefere ...

  6. iTerm2 + oh my zsh +agnoster

    安装iTerm2 iTerm2官方下载地址 http://www.iterm2.com/downloads.html 安装Oh My Bash 1.通过cat /etc/shells命令可以查看当前系 ...

  7. Flutter移动电商实战 --(29)列表页_商品列表数据模型建立

    简历数据模型 json生成dart类的网站: https://javiercbk.github.io/json_to_dart/ json数据 {"code":"0&qu ...

  8. jQuery源码解读----part 1

    来源:慕课网 https://www.imooc.com/video/4392 jQuery整体架构 jQuery按我的理解分为五大块,选择器.DOM操作.事件.AJAX与动画, 那么为什么有13个模 ...

  9. git如何添加子模块以便方便使用别人维护的模块?

    答: 添加过程如下: 1. 在当前项目的源码下执行一下命令来添加子模块 git submoduel add <other_repository_url> <dir_name> ...

  10. C++ STL partial_sort_copy greater

    #include <iostream>#include <deque>#include <algorithm>#include <vector>#inc ...