- 博客(14)
- 资源 (3)
- 收藏
- 关注
转载 struts2 action中获取request session application的方法
共四种方式: 其中前两种得到的是Map 后两种得到的才是真正的request对象 而Map就是把request对象中的属性取出做成了键值对而已。 【方法一】 [java] view plaincopy public class LoginAction { private Map request; p
2017-04-28 09:22:17
164
原创 C++第八章
1.#include #include using namespace std; double s(double,double,double); void main() { double a,b,c,d,x1,x2; cout<<"输入a,b,c:"; cin>>a>>b>>c; d=-b/(2*a); x1=d+s(a,b,c); x2=d-s(a,b,c); cout<<"x
2015-06-18 13:51:34
361
原创 C++第七章
1.#include #include using namespace std; void area(float a,float b,float c) { double s,area; if(a+b<=c) cerr<<"a+b<=c,error!"<<endl; else if(b+c<=a) cerr<<"b+c<=a,error!"<<endl; else if(a+c<
2015-06-06 20:35:34
411
原创 用一个异质链表(多态性)保存学生数据
#include #include using namespace std; class Student { public: virtual void get()=0; virtual void display()=0; string name; string num; }; class UnderGrad :public Student { public:
2015-05-27 11:31:47
435
原创 C++第六章
1. #include class Point {public: Point(float x=0,float y=0); void setPoint(float,float); float getX() const {return x;} float getY() const {return y;} friend ostream & operator<<(ostream &outp
2015-05-23 17:03:10
375
原创 多态性创建三角形的类求面积并打印
//扩展程序:创建一个三角形类 //修改create_object函数,使得程序支持三角形的创建 //和求面积、打印等操作 #include using namespace std; class Shape { public: virtual double getArea() const =0; virtual void print() const =0;
2015-05-19 20:59:31
422
原创 C++第五章
1.#include using namespace std; class Student{ public: void get_value() {cin>>num>>name>>sex;} void display() { cout<<"num:"<<num<<endl; cout<<"name:"<<name<<endl; cout<<"sex:"<<sex
2015-05-16 11:17:51
344
原创 Time Date DateTime的继承与派生及运算符重载
#include class Time{ public: Time(){} Time(int h,int m,int s) { hour=h; minute=m; second=s; } friend istream & operator>>(istream &,Time &); friend ostream & operator<<(ostream &,Time &);
2015-05-10 01:37:04
536
原创 C++第四章
1.#include using namespace std; class Complex{ public: Complex() { real=0; imag=0; } Complex(double r,double i) { real=r; imag=i; } double getreal() { return real; } double getima
2015-05-09 20:23:38
381
原创 字符串的运算符重载
#include #include #include class String { public: String(){p=NULL;} String(const String &); String(char *str); ~String(); String & operator=(const String &); String operator+(const String &
2015-04-26 23:30:27
854
1
原创 C++第三章
3.#include using namespace std; class Date { public: Date(int=1,int=1,int=2005); void display(); private: int month; int day; int year; }; Date::Date(int m,int d,int y):month(m),day(d),year(y){}
2015-04-10 13:26:10
287
原创 C++第二章
2.#include using namespace std; class Time { public: void set_time(void) { cin>>hour>>minute>>sec; } void show_time(void) { cout<<hour<<":"<<minu
2015-04-01 14:19:43
280
原创 C++第一章
7. #include using namespace std; int main() { int max(int a,int b,int c=0); int a,b,c; cin>>a>>b>>c; cout<<"max(a,b,c)="<<a<<endl; cout<<"max=(a,b)="<<a<<endl; return 0; } int max(int
2015-04-01 13:33:18
243
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人