码迷,mamicode.com
首页 >  
搜索关键字:namespace    ( 41927个结果
写一个运用到数组、枚举、强制转换和循环语句的控制台应用程序
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace CWork0408 { class Program { public enum Student { stu1...
分类:编程语言   时间:2015-04-08 10:22:40    阅读次数:102
UVa 11850 - Alaska
題目:在0~1422公里的鐵路上有n個補給站,火車每次補給后可行駛200公里,問火車能否走個來回。 分析:排序。直接排序然後計算差值即可。 說明:第一個訂單,╮(╯▽╰)╭。 #include #include #include #include #include #include using namespace std; int station[1500]; int ma...
分类:其他好文   时间:2015-04-08 09:13:37    阅读次数:103
【项目1-体验常成员函数】
设计平面坐标点类,计算两点之间距离、到原点距离、关于坐标轴和原点的对称点等。在设计中,由于求距离、求对称点等操作对原对象不能造成任何改变,所以,将这些函数设计为常成员函数是合适的,能够避免数据成员被无意更改。   ?class CPoint { private:   double x;  // 横坐标   double y;  // 纵坐标 public:   CPoint(dou...
分类:其他好文   时间:2015-04-08 09:10:25    阅读次数:126
第五周 项目四-静态成员应用
问题 设计含有静态数据成员和成员函数的Time类。静态数据成员是类中所有的对象共有的数据,在下面的设计中,时钟要采用12小时制,还是要使用24小时制,显示时,不足两位的数字前是否前导0,都是“影响全局”的设置,适合作为类中的静态数据成员。   代码:   #include using namespace std; class Time{ public: Time(in...
分类:其他好文   时间:2015-04-08 09:09:29    阅读次数:130
题解 NYOJ248 BUYING FEED
题目:http://acm.nyist.net/JudgeOnline/problem.php?pid=248 分析:英文题目,看懂了,画几下,就发现其实就是一个贪心背包的变形,水题一个~话不多少,代码走起~ /* 部分背包的变体,水题  只需要算出每个商店的单位总费用 = 原单位费用+距离的费用  */ #include using namespace std; #in...
分类:其他好文   时间:2015-04-08 09:09:24    阅读次数:120
c++ vector struct 使用
1.//test.h#include using namespace std;struct AA{ string a1; string a2; string a3;};class test{public: void ReadString(vector vv);};#incl...
分类:编程语言   时间:2015-04-08 09:07:57    阅读次数:139
通过C++修改系统时间代码
#include #include #include using namespace std;int main( void ){ SYSTEMTIME sys; GetLocalTime( &sys ); printf( "%4d/%02d/%02d %02d:%02d:%02d.%03d 星期%1...
分类:编程语言   时间:2015-04-08 06:35:41    阅读次数:134
hdu 1518 Square
关键在于优化剪枝 #include #include #include #include using namespace std; int mapp[20+5],visit[20+5]; int flag; int l,m; void dfs(int s,int x,int num) { visit[s]=1; if(x==l) num++,s=0,x=0; if(num==4) { ...
分类:其他好文   时间:2015-04-08 01:11:02    阅读次数:112
O(n)时间效率寻找字符串中第一次出现一次的字符
思路:我们利用简单的哈希映射来解决这个问题 建立一个数组,用数组的下标对应每个字符的值,然后扫描字符串,给每个字符的值对应的数组的位置的数加1,最后再扫描数组,遇到第一个1时,就可以找到对应的字符了 实现代码如下: #include #include using namespace std; char findch(const char *str, int len) { ...
分类:其他好文   时间:2015-04-08 01:10:13    阅读次数:114
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!