11 2013 档案
摘要:/******一、两圆相离、外切或至少有一圆半径为0:所求面积为0。二、两圆内切、内含:所求面积为小圆面积。三、两圆相交:这种情况分两种小情况:1、两圆心在公共弦的异侧,如图1所示;2、两圆心在公共弦的同侧如图2所示。先看图1,阴影部分可由公共弦AB分成两个弓形,求出两个弓形的面积相加即可,即S(阴影) =S(扇形O1AB)-S(三角形O1AB)+S(扇形O2AB)-S(三角形O2AB)=S(扇形O1AB)+S(扇形O2AB)-S(四边形O1AO2B),即两扇形面积和与四边面积之差。再来看图2,这时所求面积为:S(扇形O1AB)-S(三角形O1AB)+S(扇形O2AB)+S(三角形O2AB)=
阅读全文
摘要:wxwidgets编译及环境配置 安装步骤: 到www.CodeBlocks.org下载并安装CodeBlocks,最好下载MinGW版本的,可以省掉安装和配置GCC的麻烦。 到www.wxWidgets.org下载并安装wxWidgets,如果只开发Windows程序可以只下载wxMSW版本,如果
阅读全文
摘要:1 /*统计除了>之外的行里面CHED四个字母总数*/ 2 #include 3 #include 4 #include 5 using namespace std; 6 7 class FindLetter 8 { 9 private:10 ifstream m_r;11 ofstream m_w;12 string m_falphabet,m_temp;13 char m_jump;//要跳跃的字符14 unsigned int *m_number,m_length;//计数 和 文件中的一行的个数...
阅读全文
摘要:共用的几个源代码文件: main.c 2.c 3.c 代码依次为: 1 #include<stdlib.h> 2 #include "a.h" 3 extern void function_two(); 4 extern void function_three(); 5 6 int main() 7
阅读全文
摘要:#includeusing namespace std;class Shape{public:void getArea(){cout<<"this is Shape class"<<endl;}};class Rectangle:public Shape{private:double x,y;public: void putbox(const int newx,const int newy){x=newx;y=newy; cout<<"x,y="<<x<<","<<
阅读全文
摘要:我在更新软件源后,看了看最新版的GTK开发版是3.0的。 所以,基本可以照搬。 写成一句话: GTK的演示程序: gtk-demo 当然,这是在编译widgets必要条件!
阅读全文
摘要:1 跟我一起写 Makefile 2 /**/ 3 4 陈皓 (CSDN) 5 6 概述 7 —— 8 9 什么是makefile?或许很多Winodws的程序员都不知道这个东西,因为那些Windows的IDE都为你做了这个工作,但我觉得要作一个好的和professional的程序员,makefil
阅读全文
摘要:Fedora19 有关输入法的无法切换问题 和 终端的快捷设置问题 1.首先,要单击右上角的设置输入法的"区域与语言设置",要设置为“为每个窗口设置不同的输入源”。 还有,刚使用的初学者不知道 "super L“这个键,其实就是 win 就是键盘上的 windows 窗口图标。 那么切换键为,win
阅读全文
摘要:Fedora19添加和设置YUM源添加yum源前先安装fastestmirror/downloadonly插件和axelget插件: 1.安装fastestmirror/downloadonly插件 由于yum中有的mirror速度是非常慢的,如果yum选择了这个mirror,这个时候yum就会非常
阅读全文
摘要:想学shell的同学请记住: 如果你写好脚本后不给脚本执行权限那也是不行的: 添加执行权限: chmod +x 脚本名.sh 在Linux shell中有一个脚本编译命令: bash -v 脚本名.sh bash -x 脚本名.sh example: bash -v test.sh bash -x
阅读全文
摘要:#ifdef __cplusplus #include <cstdlib> #else #include <stdlib.h> #endif #include <SDL/SDL.h> #include <string> const int SCREEN_WIDTH=640; const int SC
阅读全文
摘要:1 #ifdef __cplusplus 2 #include <cstdlib> 3 #else 4 #include <stdlib.h> 5 #endif 6 7 #include <SDL/SDL.h> 8 9 int main( int argc, char* args[] ) 10 {
阅读全文
摘要:1 #include<iostream> 2 using namespace std; 3 4 class Base0 5 { 6 public: 7 int var0; 8 void fun0() 9 { 10 cout<<"Member of Base0"<<endl; 11 } 12 }; 1
阅读全文
摘要:1 //多继承同名隐藏 2 #include <iostream> 3 4 using namespace std; 5 6 class Base1 7 { 8 public: 9 int var; 10 void fun() 11 { 12 cout<<"Member of Base1"<<end
阅读全文
摘要:#include<unistd.h> #include<stdlib.h> #include<stdio.h> #include<string.h> #define BUFSIZE 200 int main() { FILE *read_fp; char buffer[BUFSIZE+1];/*用于
阅读全文
摘要:1 #include <iostream> 2 #include <iomanip> 3 #include <string> 4 5 using namespace std; 6 7 struct Student 8 { 9 int num; 10 string name; 11 char sex;
阅读全文
摘要:Linux下的在线播放神器:一个是Amarok缺点是,每个音乐源都要更新后才能播放。 在一个就是中国造的:linux deepin下的深度音乐,缺点就是连不上。反正我是连不上
阅读全文
摘要:1 #include 2 3 using namespace std; 4 class Point 5 { 6 public: 7 Point(int x=0,int y=0):x(x),y(y){} 8 int getX() const {return x;} 9 int getY() const {return y;}10 private:11 int x,y;12 };13 int main()14 {15 Point a(4,5);16 Point * p1=&a;17 18 int (Point::*funcPtr)() c...
阅读全文
摘要://6-13#includeusing namespace std;class Point{public: Point(int x=0,int y=0):x(x),y(y){} int getX() const {return x;} int getY() const {return y;}private: int x,y;};int main(){ Point a(4,5); Point * p1=&a; int (Point::*funcPtr)() const=&Point::getX; cout*funcPtr)()getX() 2 //...
阅读全文
摘要:1 #include 2 3 using namespace std; 4 5 void printStuff(float data) 6 { 7 cout<<"this is the print stuff function."<<endl; 8 } 9 10 void printMessage(float data)11 {12 cout<<"the data to be listed is"<<data<<endl;13 }14 15 void printFloat(float data)
阅读全文
摘要:1 #include 2 3 using namespace std; 4 5 void splitFloat(float x,int * intPart,float * fracPart) 6 { 7 *intPart=static_cast(x); 8 *fracPart=x-*intPart; 9 }10 11 12 int main()13 {14 cout>x;20 splitFloat(x,&n,&f);21 cout<<"Inter Part="<<n<<"Fraction Part=&quo
阅读全文
摘要:1 #include 2 3 using namespace std; 4 5 6 int main() 7 { 8 int i; 9 int *ptr=&i;10 i=10;11 cout<<"i="<<i<<endl;12 cout<<"*ptr="<<*ptr<<endl;13 14 return 0;15 }
阅读全文
摘要://在weight.h中#ifndef _WEIGHT_H_#define _WEIGHT_H_class Car;class Boat{ private: double weight; public: Boat(double w=0.0):weight(w){} double getWeight(){return weight;} friend double getTotalWeight(Car & m,Boat & n);};class Car{ private: double weight; p...
阅读全文
摘要:1 #include 2 3 int main() 4 { 5 int line1[]={1,0,0}; 6 int line2[]={1,0,0}; 7 int line3[]={1,0,0}; 8 9 int * pLine[3]={line1,line2,line3};10 11 std::cout<<"Matrix test:"<<std::endl;12 13 14 for(int i=0;i<3;++i)15 for(int j=0;j<3;j++)16 std::cout<<pLine[...
阅读全文
摘要:1 #include 2 3 using namespace std; 4 5 class A 6 { 7 public: 8 A(int i); 9 void print();10 private:11 const int a;12 static const int b=10;13 };14 15 16 A::A(int i):a(i){}17 18 void A::print()19 {20 cout<<a<<":"<<b<<endl;21 }22 //常成员函数只能通过初始化来获得初值23 24 int main()25
阅读全文
摘要:1 #include 2 3 using namespace std; 4 5 class A 6 { 7 private: 8 int x,y; 9 public:10 A(int i,int j):x(i),y(j){}11 void Adisplay() const12 {13 cout<<"x="<<x<<" "<<"y="<<y<<endl;14 }15 };16 17 int main()18 {19 const A a(5,4);20 a.Adisp
阅读全文
摘要:1 #include 2 3 using namespace std; 4 5 class Point 6 { 7 public: 8 Point(int x=0,int y=0):x(x),y(y){} 9 int getX() const {return x;}10 int getY() const {return y;}11 private:12 int x,y;13 };14 int main()15 {16 Point a(4,5);17 Point *p1;p1=&a;18 cout<<(*p1).getX()<<end...
阅读全文
摘要://在weight.h中#ifndef _WEIGHT_H_#define _WEIGHT_H_class Point{public: Point(int x=0,int y=0):x(x),y(y){} int getX(){return x;} int getY(){return y;} friend float dist(Point &p1,Point &p2) { double x=p1.x-p2.x; double y=p1.y-p2.y; return static_cast(sqrt(x*x+y*y)); }private: ...
阅读全文
摘要:1 #include 2 using namespace std; 3 class Point 4 { 5 public: 6 Point(int xx=0,int yy=0) 7 { 8 x=xx; 9 y=yy;10 cout<<"Constructor is called"<<endl;11 }12 Point(Point &p);13 int getX()14 {15 return x;16 }17 int getY()18 {19 ...
阅读全文
摘要:#include using namespace std;class A{public: void display(){cout<<x<<endl;} int getX() {return x;} friend class B;private: int x;};class B{public: void set(int i); void display() { a.display(); };private: A a;};void B::set(int i){ a.x=i;}int main(){ cout << "H...
阅读全文
摘要:Problem Description 给定K个整数的序列{ N1, N2, ..., NK },其任意连续子序列可表示为{ Ni, Ni+1, ..., Nj },其中 1 <= i <= j <= K。最大连续子序列是所有连续子序列中元素和最大的一个, 例如给定序列{ -2, 11, -4, 1
阅读全文
摘要:1 在小学的时候,我们的学生都能把“整数表示成分母是1的分数”,而且大多数学生也都能把有限小数和循环小数表示成分数的形式.这样,整数、分数、有限小数、循环小数都属于有理数.教科书中说“整数和分数统称有理数”,其中当然包括有限小数和无限循环小数. 2 3 例 把3, 0.2, ,,,表示成分数. 4
阅读全文
摘要:由于在C++数据结构中的代码不完整,特补全。等日后当工程库调用。若有疑问,请留言.#includeusing namespace std;templatestruct Node{ T data; Node *next;};template class LinkStack{private: Node *top;public: LinkStack(){top=NULL;} ~LinkStack(); void Push(T x); void Pop(); T GetTop(); int StackEmpty(); void ClearSt...
阅读全文

浙公网安备 33010602011771号