第一次在BLOG上写东西

作 者: isince2003
时 间: Wed Sep 29 15:11:18 2004

以前知道 BLOG,但是从来没想过自己在上面写些东西,毕竟别人可以看到,写得深了 ,怕人知道自己隐私,写得浅了又没什么意思。

有自己的朋友在一些博客网站上也写自己的心情,看着挺羡慕的,想想也没什么大不了的,算是自己发发牢骚,别说别人不知道,就算知道了也没什么。

昨天是八月十五,有好多朋友发短信祝福自己,有别人想着就是觉得挺幸福的,只是 有点觉得对不起大家,因为忙着一些事情,并没有回多少条,自己也没给几个人发信息。 虽然说短信是廉价的祝福,但是做与不做还是不一样的。

浦口校园里的桂花开了,到处都是香气,家在北方的我来南大以前并不知道什么是桂花,和它的香味是什么样的,去年的这个时候,第一次知道什么叫花香四溢,算是见识到 了桂花的厉害。在人的记忆里,总能凭一些东西想起来些什么,都是冷不丁的就出来了。 就像现在走在路上,闻到香味,就想起了去年自己怎么在这里怎样的走过,想起来那时候还像一个固执的孩子,坚守着某些珍贵的东西。而今天,自己又是怎么样,唉,谁知道呢 ?

感觉最强烈的就是高三的时候,是秋季,天气刚开始起凉风,走在路上,忽的就想起来自己高一时怎么带着包包裹裹走进那时侯感觉神秘的高中,好象看到从路的那头走来了 稚嫩的自己,而高三的自己也向他走去,真的是感慨万千那,两年就这么容易的就过去了 ,我也成了一个面对高考的压迫的可怜的孩子。不过要是真的想想自己做过的事情,并不 觉得后悔或者是浪费时间,有那么多好朋友关心着我,当我回想起自己的高中生活时,我 发现我能想起来的只有快乐,和青春时候的淡淡忧愁。高中时候有句名言:“我可不愿意做一个整天忙着读书的学生,不愿意当我回忆起高中生活的时候,只有数学课本和英语单词。

不能回家的长假

作 者: isince2003
时 间: Thu Sep 30 17:59:12 2004

十一长假,好多人都回去了,看着别人走,挺羡慕的。

高中的时候想着考大学一定要考很远,考到妈妈看不见的地方,然后自己在那就可以 为所欲为了。呵呵,想想这些想法也是够搞笑的,自己走得再远也是妈妈的孩子,不管身 份怎么变,母亲仍然是母亲。她是永远有资格教训自己的。

来南京上学是原来的一个打算,原来是觉得喜欢这个城市,真的来了,才发现,自己 喜欢的只是那个古时候有着风花雪月却又颠沛流离的南京,而不是现在夹在发展的空隙中 ,不知道何去何从的落魄的南京城。曾经是小弟弟的苏锡常却一跃居上,生产总值是南京 的几倍,总是让这个老大哥不甘心。而自己又有着一些古旧的东西扔不下,现代的东西进 不来,总算还暂时有着一个相对来说仍然是文化中心的地位,又难保在这个强势经济的霸 权文化冲击下能坚守住这个位置。这就是我眼中的南京,一个北方人眼中的南京总是让人 觉得那么小气,习惯了方方的城市,方方的房子,直直的路还有慷慨的北方人,然后怎么 看南京都觉得有一点小别扭。

毕竟是一方水土养一方人那,这些东西是怨不得也骂不得的。南方人的精细使他们自 古就是富庶之乡,而北方老实的农民只能跑到南面来给他们打工。南方人对别人隐私的重 视,虽然一方面表现为各人自扫门前雪,但是在另一个方面也少了很多侵犯他人的可能性 。

以前总是看到骂河南人的东西,刚开始还是很气愤,后来渐渐得不觉得什么了,毕竟河南有一亿多人,你不能要求别人按照你的做事原则去理解某些东西。但是笼统的说河南 人怎么怎么样,就像说中国人怎么怎么样一样,都不是正确的。所以说,在一个北方人眼 中的南方人也只是代表个人观点,并不涉及到什么攻击。

虽然南京不怎么样,南大还是很舒服的,一开始在浦口,还总是抱怨这抱怨那的,过了一年来,发现自己喜欢浦口肯定会超过喜欢鼓楼,也许吧,可能是时间能改变很多东 西。

在浦口这一年,没有做什么事,社团没有参加,学生会没有加入,凡是一切涉及到别人的活动一概没有什么作为。只是静静的看了一年书,交的朋友不多,还算有一两个, 算是知足了。大学毕竟不是中学,离社会近了一步,人和人关系就复杂一点,虽然没有钱锺书先生的慧眼,但也总算十几年没有白活,一些东西还是能看出来的。说到这总会想起 来高中时候的幸福生活,比起来这么多年的学生生涯,虽然高中时候最累,但真的是很幸福。回忆起一些事情,总是还有那么一些怀念在里面。

第一次长假就是去玄武湖,人山人海呀,公交直做了两个小时,到公园还被通知涨价,经历了好些折腾,就发誓以后长假再不出去了。又加上下了五六天的雨,老天不给面子。就只好放弃了。在机房里泡了几天。长假就过去了,当时就有些后悔自己为什么不回家呢。

第二次长假是特想回去,可是怕见一个人,人就是这些讨厌,总会考虑到别人的存在,像挤在罐头里的鱼,动都不能动。非常遗憾的没有回去。

然后就到这次了,这次就根本没有回去的打算,也是因为那么多次都没有回去,也是习惯了。就是不知道这次留这能做些什么,唉,有一句话说得真哲理,计划就是计划。

写了这么半天,倒是像给朋友写一封信,反正是自己的话,管它像什么呢。

关于成绩排名问题的程序

/*
说明:
[1]运行:
程序有一点小问题,运行输出的时候会出现重复。
*/
#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
#include <string.h>

#define MAX_NUM 100

class Information{
public:
char id[8], name[12];
int score;

public:
Information & operator=(Information &b)
{ strcpy(id,b.id);
strcpy(name,b.name);
score=b.score;
return *this;
}
};

void main()
{

char filename1[256],filename2[256];

cout<<"输入源文件全路径:";
cin>>filename1;

cout<<"输入目的文件全路径:";
cin>>filename2;

ifstream infile(filename1,ios::in|ios::nocreate);
ofstream outfile(filename2);

if(! infile){
cout<<"不能打开输入文件:"<<filename1<<’/n’;
exit(1);
}
if(! outfile){
cout<<"不能打开目的文件:"<<filename2<<’/n’;
exit(2);
}

Information student[MAX_NUM],temp;

char t_id[8],t_name[12];

int t_score,count=0,i;

while(infile>>t_id)
{
infile>>t_name>>t_score;
strcpy(student[count].id,t_id);
strcpy(student[count].name,t_name);
student[count].score=t_score;
count++;
}

for( i=0;i<count;i++)
for(int j=i+1;j<count;j++)
if(student[i].score<student[j].score)
{
temp=student[i];
student[i]=student[j];
student[j]=temp;
}

for(i=0;i<count;i++)
outfile<<student[i].id<<"(A)"<<student[i].name<<"(B)"<<student[i].score<<’

’;
cout<<"已将排序后成绩写入"<<filename2<<"中。"<<endl;

infile.close();
outfile.close();

}
源文件内容:
45991901 王成 89
45991902 李名 75
45991903 张三 95
45991904 赵五 87
45991905 王立 88
45991906 孙羽政 86
45991907 周小国 85
45991908 范预 98
45991909 刘二 92
45991910 张宗 74
45991911 苏栏 73
45991912 赵新 71
45991913 曾梅每 70
45991914 李开创 69
45991915 姚为国 79
45991916 武彬 68
45991917 马三轮 61
45991918 左右 65

运行结果:
45991908范预(A)范预(B)98
45991903张三(A)张三(B)95
45991909刘二(A)刘二(B)92
45991901王成(A)王成(B)89
45991905王立(A)王立(B)88
45991904赵五(A)赵五(B)87
45991906孙羽政(A)孙羽政(B)86
45991907周小国(A)周小国(B)85
45991915姚为国(A)姚为国(B)79
45991902李名(A)李名(B)75
45991910张宗(A)张宗(B)74
45991911苏栏(A)苏栏(B)73
45991912赵新(A)赵新(B)71
45991913曾梅每(A)曾梅每(B)70
45991914李开创(A)李开创(B)69
45991916武彬(A)武彬(B)68
45991918左右(A)左右(B)65
45991917马三轮(A)马三轮(B)61

排序函数:第一种做法:用STL:

这是老师给的程序:************stdafx.h**************
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#if !defined(AFX_STDAFX_H__12C9FDA9_9863_4D79_8C94_1739D2996569__INCLUDED_)
#define AFX_STDAFX_H__12C9FDA9_9863_4D79_8C94_1739D2996569__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers

#include<iostream>
#include<fstream>
#include<algorithm>
#include<string>
#include<vector>
#include<iomanip>

//#include <afxtempl.h>
//#include <afx.h>
#include <time.h>

// TODO: reference additional headers your program requires here

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before

the previous line.

#endif // !defined(AFX_STDAFX_H__12C9FDA9_9863_4D79_8C94_1739D2996569__INCLUDE

D_)

************stdafx.cpp**************
// stdafx.cpp : source file that includes just the standard includes
// GradeResort.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"

// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

*********************gradesort.h*****************
#ifndef SORT_METHODS_H
#define SORT_METHODS_H

#include "stdAfx.h"

using namespace std;

class Grade{
public:
string id;
string name;
int grade;
public:

void SetId(string i) { id = i; }
void SetName(string n) { name = n; }
void SetGrade(int g) { grade = g; }
string GetId() { return id; }
string GetName() { return name; }
int GetGrade() { return grade; } const

Grade(string i,string n,int g):id(i),name(n),grade(g){}
Grade() { id="";name="";grade=0;}
bool operator<(const Grade& y) const
{
if(this->grade < y.grade)
return true;
else if(this->grade == y.grade && this->id < y.id)
return true;
else
return false;
}
bool operator==(const Grade& y) const
{
return (this->grade == y.grade && this->id == y.id) ? true : false;
}
};

#endif SORT_METHODS_H

**********************graderesort.cpp*********************************
// GradeResort.cpp : Defines the entry point for the console application.
//

#include "stdAfx.h"
#include "GradeSort.h"

int main(int argc, char* argv[])
{
ifstream fin("oldgrade.txt");
vector<Grade> gVector;

Grade tempGrade;
do {
fin >> tempGrade.id >> tempGrade.name >> tempGrade.grade;
gVector.push_back(tempGrade);
} while(!fin.eof());

ofstream fout("sortedGrade.txt");
sort(gVector.begin(), gVector.end());
int cnt =gVector.size();

fout.setf(ios::left);
for(int i=0; i<cnt; i++) {
tempGrade = gVector[i];
fout << setw(15) << tempGrade.id << " "
<< setw(15) << tempGrade.name << " "
<< setw(5) << tempGrade.grade << endl;
}
return 0;
}

排序函数:第二种做法(内有三种子方法)

第二种做法:内有三种子方法;

// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#if !defined(AFX_STDAFX_H__E3A2A4D8_18B3_40A0_A613_E0CEA5245DC1__INCLUDED_)
#define AFX_STDAFX_H__E3A2A4D8_18B3_40A0_A613_E0CEA5245DC1__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers

#include <stdio.h>
#include<iostream.h>
#include<fstream.h>
#include<string.h>
#include<iomanip.h>
#include <stdlib.h>

// TODO: reference additional headers your program requires here

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before

the previous line.

#endif // !defined(AFX_STDAFX_H__E3A2A4D8_18B3_40A0_A613_E0CEA5245DC1__INCLUDE

D_)

**************************************

// stdafx.cpp : source file that includes just the standard includes
// GradeResort2.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"

// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

**************************************

#ifndef RECORD_RESORT
#define RECORD_RESORT

#include "stdAfx.h"

#define BUF_SIZE 1024
#define MAX_NUM 200

struct Grade {
char id[12];
char name[20];
int grade;
};

int compare(const void *arg1, const void* arg2);

#endif

***************************************

// GradeResort2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "GradeResort2.h"
#include <strstrea.h>

int compare(const void *arg1, const void* arg2)
{
Grade *g1, *g2;
g1 = (Grade *) arg1;
g2 = (Grade *) arg2;

if(g1->grade < g2->grade) return -1;
else if(g1->grade == g2->grade) return strcmp(g1->id, g2->id);
else return 1;
}

int main(int argc, char* argv[])
{
Grade gArray[MAX_NUM], tempGrade;
int count = 0;

///*
ifstream fin("oldgrade.txt");
char buf[BUF_SIZE];
while(fin.getline(buf, BUF_SIZE)) {
strstreambuf sbuf = strstreambuf(buf, BUF_SIZE);
istream in(&sbuf);
in >> tempGrade.id >> tempGrade.name >> tempGrade.grade;
gArray[count++] = tempGrade;
}
//*/

/*
ifstream fin("oldgrade.txt");
char buf[BUF_SIZE];
while(fin.getline(buf, BUF_SIZE)) {
sscanf(buf, "%s%s%d", tempGrade.id,
tempGrade.name, &tempGrade.grade);
gArray[count++] = tempGrade;
}
*/

/*
FILE *fin = fopen("oldgrade.txt", "r");
while(fscanf(fin, "%s%s%d", tempGrade.id,
tempGrade.name, &tempGrade.grade) == 3) {
gArray[count++] = tempGrade;
}
*/
qsort(gArray, count, sizeof(Grade), compare);

ofstream fout("sortedGrade.txt");
fout.setf(ios::left);
for(int i=0; i<count; i++) {
tempGrade = gArray[i];
fout << setw(12) << tempGrade.id << " "
<< setw(20) << tempGrade.name << " "
<< setw(4) << tempGrade.grade << endl;
}

return 0;
}

朋友的留言簿

作 者: isince2003
时 间: Sat Oct 9 18:16:59 2004

我问你蒹葭苍苍是不是在江湖,
你说水茫茫迷失了停泊的洲渚;
我问你彼黍离离是不是在江湖,
你说月悠悠捉不住流离的秦鹿;
我问你有没有英雄笑傲江湖,
你说五风烟挽不住寂寞的陶朱;
我问你有没有佳人遗世江湖,
你说空日暮找不到闲倚的修竹。

About "double" in C

昨天发现一个很有趣的现象,在 Turbo C 里 double 类型的变量无法用通常模式进行输入操作,即无法用 scanf() 进行赋值,程序举例:

void main()
{
  double a,b,c;
  scanf("%f%f%f",&a,&b,&c);
  printf("%f%f%f",a,b,c);
}

输出结果均是 0.000000,猜想 C 语言应该没有默认初始值的功能,之所以是 0.000000 可能是保留六位小数的原因,由于数值较小且跟地址有关,输入的数值没有传入到地址中。如果将 double 型改为 float 型,则能正常操作。是何道理?难道 C 里输入函数对 double 不兼容?还是另有其他输入方法?回去要查一下 MSDN,不知道 C 有没有专门的帮助文档。

还有要注意的是 TC2 和 TC3 之间对程序要求的变化,在 TC3 中如果不包含标准输入输出的头文件 stdio.h,程序中使用 scanf 和 printf 会报错,而且主函数也必须声明类型,不然会有警告。难道是 ANSI C 的标准变了?还是 TC 为了完善自己只适用于 TC?看来还是要注意编译软件的兼容性问题。 C 语言在好多地方还是不如 C++ 呀!

PS: 输出结果是 0.000000 的原因是因为 scanf() 如果取不到值就会把变量赋零。

2009年6月11日15:40
只因当时年纪小呀,这篇博客现在让我看都快要笑死了。为了不误导读者,特更正如下:
1. 之所以读取错误,是因为本文中程序是错的,%f 匹配浮点类型,%lf 才能匹配 double 类型,这不是 scanf 的错。
2. TC3 对程序的检查是正确的,C 标准确实有变化,我当时是受一本错误的 C 语言教科书误导。
3. C 虽然很多地方不如 C++,但是 C 有简洁性的长处,C++ 是不能比的。

Something About Scanf() In C (1)

一. scanf 函数输入格式中的字符串

scanf 函数输入格式中也可以含有普通字符串,但他的含义是这些字符必须在输入中出现,例如:

int num;
scanf("hello %d", &num);

他的含义是首先要求输入一个hello字符串,然后再输入一个十进制数。 注意在等待输入时忽略hello与要输入的数之间的空格,制表符,回车。

因此这两种输入都是正确的: hello 1234 hello1234

二. scanf函数的返回值

程序:

{
  int num, result=0;
  printf("please input the student’s score: ");
  while(result==0) {
    /* 清空输入缓冲区。 */
    fflush(stdin);
    if(result!=1) printf("Please input a digital score: ");
    result=scanf("%d",&num);
  }
}

一切OK!

三. scanf函数中一个参数的应用

在 scanf 函数中,我们可以使用 %c 来读取一个字符,使用 %s 读取一个字符串。 但是读取字符串时不忽略空格,读字符串时忽略开始的空格,并且读到空格为止,因此我们只能读取一个单词,而不是整行字符串。因此一般使用 fgets 来读取一个字符串。

其实 scanf 函数也可完成这样的功能,而且还更强大。 这里主要介绍一个参数:%[] ,这个参数的意义是读入一个字符集合。 [] 是个集合的标志,因此 %[] 特指读入此集合所限定的那些字符, 比如 %[A-Z] 是输入大写字母,一旦遇到不在此集合的字符便停止。 如果集合的第一个字符是"^", 这说明读取不在 "^" 后面集合的字符,既遇到 "^" 后面集合的字符便停止。注意此时读入的字符串是可以含有空格的。 Eg: 输入一个字符串, 这个字符串只含有小写字符。遇到第一个不是小写字符时停止, scanf("%[a-z], str); Eg: 想输入一个字符串, 遇到 "." 停止,可设计如下: scanf("%[^.]", str); 使用这个参数,你可以完成许多强大的功能呦!

通常来讲,scanf 函数和他的一些参数并不是很常用,主要是因为:

1. 许多系统的 scanf 函数都有漏洞。 (典型的就是TC再输入浮点型时有时会出错)。

2. 用法复杂,容易出错。

3. 编译器作语法分析时会很困难,从而影响目标代码的质量和执行效率。

三次方程求法

#include <iostream.h>
#include <math.h>
#include <iomanip>
#include <fstream.h>
#include <stdlib.h>

#define f(x) (1*x*x*x-3*x*x-6*x+8)

double bisection(double x,double y,double z)
{
double a=x,b=y,p;
while(((b-a)/2)>=z)
{ p=(a+b)/2;
if(f(p)*f(b)<=0)
a=p;
else b=p;
}
return p;

}

void main()
{
double a[5];
char filename[256];
cout.setf(ios::fixed);
cout<<"请输入误差容限:";
cin>>a[0];
cout<<"输入目的文件全路径:";
cin>>filename;
ofstream outfile(filename);
a[2]=(3-sqrt(21))/2;
a[3]=(3+sqrt(21))/2;
a[1]=a[2];
a[4]=a[3];
for(int i=1; ;i++)
{
if(f(a[1])>=0) a[1]--;

else if(f(a[4])<=0) a[4]++;
else break;
}
for(i=1;i<4;i++)

outfile<<"函数f(x)在区间("<<a[i]<<’,’<<a[i+1]<<")上的根为"<<bisection(a[i],a[i+1],a[0])<<endl;

cout<<"已经将结果写入:"<<filename<<endl;
cout<<"误差在"<<a[0]<<"之内."<<endl;
outfile.close();
}

input=============

f:output.txt //可以是任何路径
1e-7

output============

函数f(x)在区间(-2.79129,-0.791288)上的根为-2
函数f(x)在区间(-0.791288,3.79129)上的根为1
函数f(x)在区间(3.79129,4.79129)上的根为4

按比例列选主元Gauss消去法求线性方程组的解

实习二

用按比例列选主元Gauss消去法求下列线性方程组Ax=b的解。

系数矩阵A:
15 7 6 5 1
7 10 8 7 2
6 8 10 9 3
5 7 9 10 4
1 2 3 4 5

右端向量b:

-4.0000
21.0000
13.2000
5.0000
-9.0000

要求:输出每次选取的主元的行号,解向量x.
输出时要有一定的文字说明,以使输出结果一目了然。

#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
#include <math.h>
void main()
{
char filename1[256],filename2[256];
cout<<"Enter the path to input file:";
cin>>filename1;
cout<<"Enter the path to output file:";
cin>>filename2;
ifstream infile(filename1,ios::in|ios::nocreate);
ofstream outfile(filename2);
if(!infile){
cout<<"Can’t open input file:"<<filename1<<’
’;
exit(1);
}

int k,m,i,j,n,w;
infile>>n;
w=n+1;

double *p,*x;
double t;

p=new double[w*w];
x=new double[w];
for(i=0;i<w;i++) p[i]=0;
for(i=w;i<w*w;i++)
infile>>p[i];

for(k=1;k<n;k++) //step 1

{
t=p[k*w+k-1];
m=k;
for(i=k;i<w;i++) //step 2
{ if(fabs(p[i*w+k-1])>fabs(t))
{ t=p[i*w+k-1];
m=i;
}
}
if(t<1e-8) //step 3
{ cout<<"A is singular"<<endl;
exit(2);
}
outfile<<"第"<<k<<"列的主元行号为:"<<m<<’
’;
//----------------------------------------
if(m!=k) //step 4
for(j=k;j<w+1;j++)
{ t=p[k*w+j-1];
p[k*w+j-1]=p[m*w+j-1];
p[m*w+j-1]=t;
}
for(i=k+1;i<w;i++) //step 5
{ p[i*w+k-1]=p[i*w+k-1]/p[k*w+k-1]; //step 6
for(j=k+1;j<w+1;j++) //step 7
p[i*w+j-1]=p[i*w+j-1]-p[i*w+k-1]*p[k*w+j-1];
}

}
x[n]=p[n*w+n]/p[n*w+n-1]; //step 8

for(k=n-1;k>0;k--) //step 9
{ t=0;
for(j=k+1;j<n+1;j++) t+=p[k*w+j-1]*x[j];
x[k]=(p[k*w+n]-t)/p[k*w+k-1];
}
outfile<<"方程组的根为:("; //step 10
for(i=1;i<n;i++)
outfile<<x[i]<<’,’;
outfile<<x[n]<<’)’;
infile.close();
outfile.close();

}
input===========

5
15 7 6 5 1 -4.0000
7 10 8 7 2 21.0000
6 8 10 9 3 13.2000
5 7 9 10 4 5.0000
1 2 3 4 5 -9.0000

output==========

第1列的主元行号为:1
第2列的主元行号为:2
第3列的主元行号为:3
第4列的主元行号为:4
方程组的根为:(-2.01506,3.73891,2.00518,-1.87662,-2.59436)

修改的LDLt分解

#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>

int main()
{
char filename1[256],filename2[256];
cout<<"Enter the path to input file:";
cin>>filename1;
cout<<"Enter the path to output file:";
cin>>filename2;
ifstream infile(filename1,ios::in|ios::nocreate);
ofstream outfile(filename2);
if(!infile)
{
cout<<"Can not open input file:"<<filename1<<’
’;
exit(1);
}

int n,w,k,i,j;
infile>>n;
w=n+1;

double *a,*x,*b,*g;
double t;

a=new double[n*n];
g=new double[w];
x=new double[w];
b=new double[w];
for(i=0;i<n*n;i++)
infile>>a[i];
for(i=1;i<w;i++)
infile>>b[i];

if(a[0]<1e-8) //Step1
{
cout<<"Method failed!";
exit(2);
}
/*其实这里可以定义:#define a(int u,int v) a[u*n-n+v-1]
这样引用起来比较直观!但是运算是一样的.*/
g[1]=a[n]; //Step2
a[n]=g[1]/a[0];
a[n+1]-=g[1]*a[n];
if(a[n+1]<1e-8) //Step3
{
cout<<"Method failed!";
exit(3);
}
for(i=3;i<w;i++) //Step4
{
g[1]=a[i*n-n]; //Step5
for(j=2;j<i;j++) //Step6
{
for(t=0,k=1;k<j;k++)
t+=g[k]*a[j*n-n+k-1];
g[j]=a[i*n-n+j-1]-t;
}
a[i*n-n]=g[1]/a[0]; //Step7
for(j=2;j<i;j++) //Step8
a[i*n-n+j-1]=g[j]/a[j*n-n+j-1];
for(t=0,k=1;k<i;k++) //Step9
t+=g[k]*a[i*n-n+k-1];
a[i*n-n+i-1]-=t;
if(a[i*n-n+i-1]<1e-8) //Step10
{
cout<<"Method failed!";
exit(4);
}
}
for(i=2;i<w;i++) //Step11
{
for(t=0,k=1;k<i;k++)
t+=a[i*n-n+k-1]*b[k];
b[i]-=t;
}
x[n]=b[n]/a[n*n-1]; //Step12
for(i=n-1;i>0;i--) //Step13
{
for(t=0,k=i+1;k<w;k++)
t+=a[k*n-n+i-1]*x[k];
x[i]=b[i]/a[i*n-n+i-1]-t;
}

for(i=1;i<w;i++)
outfile<<"g("<<i<<")="<<g[i]<<’
’;

outfile<<"y=(";
for(i=1;i<n;i++)
outfile<<b[i]<<’,’;
outfile<<b[n]<<");
";

outfile<<"diag(D)=(";
for(i=1;i<n;i++)
outfile<<a[i*n-n+i-1]<<’,’;
outfile<<a[n*n-1]<<");
";

outfile<<"L=
";
for(i=1;i<w;i++)
{ for(j=1;j<w;j++)
{ if(j<=i)
outfile<<’ ’<<a[i*n-n+j-1];
else outfile<<’ ’<<’0’;
}
outfile<<’
’;
}

outfile<<"The roots are:("; //Step14
for(i=1;i<n;i++)
outfile<<x[i]<<’,’;
outfile<<x[n]<<");";
delete a;
delete g;
delete b;
delete x;
infile.close();
outfile.close();
return 0;
}
input=============

10
1 1 1 1 1 1 1 1 1 1
1 2 2 2 2 2 2 2 2 2
1 2 3 3 3 3 3 3 3 3
1 2 3 4 4 4 4 4 4 4
1 2 3 4 5 5 5 5 5 5
1 2 3 4 5 6 6 6 6 6
1 2 3 4 5 6 7 7 7 7
1 2 3 4 5 6 7 8 8 8
1 2 3 4 5 6 7 8 9 9
1 2 3 4 5 6 7 8 9 10
8 2 -12 4 -45 6 -5 9 10 30

output=============

g(1)=1
g(2)=1
g(3)=1
g(4)=1
g(5)=1
g(6)=1
g(7)=1
g(8)=1
g(9)=1
g(10)=-6.27744e+066
y=(8,-6,-14,16,-49,51,-11,14,1,20);
diag(D)=(1,1,1,1,1,1,1,1,1,1);
L=
1 0 0 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0 0 0
1 1 1 0 0 0 0 0 0 0
1 1 1 1 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0
1 1 1 1 1 1 0 0 0 0
1 1 1 1 1 1 1 0 0 0
1 1 1 1 1 1 1 1 0 0
1 1 1 1 1 1 1 1 1 0
1 1 1 1 1 1 1 1 1 1
The roots are:(14,8,-30,65,-100,62,-25,13,-19,20);

三对角方程组的追赶法求解方程组的解

#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>

int main()
{
char /*filename1[256],*/filename2[256];
// cout<<"Enter the path to input file:";
// cin>>filename1;
cout<<"Enter the path to output file:";
cin>>filename2;
// ifstream infile(filename1,ios::in|ios::nocreate);
ofstream outfile(filename2);
// if(!infile)
// {
// cout<<"Can not open input file:"<<filename1<<’
’;
// exit(1);
// }
int n,w,k;
// infile>>n;
n=50;
w=n+1;
double *a,*b,*d,*c,*p,*q,*x,*y,*Iy,*Ix;

a=new double[w];
d=new double[w];
c=new double[w];
b=new double[w];
p=new double[w];
q=new double[w];
x=new double[w];
y=new double[w];
Iy=new double[w];
Ix=new double[w];

//输入======================================================================================

/*

int i;
infile>>d[1]>>c[1];
// infile.seekg((n-3)*sizeof(double));
// infile.seekg((n-3)*sizeof(int),ios::cur);
for(k=0;k<n-3;k++)
infile>>a[0];
infile>>a[1];

for(k=2;k<n;k++)
{
// infile.seekg((k-2)*sizeof(int),ios::cur);
for(i=0;i<k-2;i++)
infile>>a[0];
infile>>a[k]>>d[k]>>c[k];
// infile.seekg((n-k-1)*sizeof(int),ios::cur);
for(i=0;i<n-k-1;i++)
infile>>a[0];
}
infile>>c[n];
// infile.seekg((n-3)*sizeof(int),ios::cur);
for(i=0;i<n-3;i++)
infile>>a[0];
infile>>a[n]>>d[n];
for(k=1;k<w;k++)
infile>>b[k];
*/
for(k=1;k<w;k++)
{
a[k]=1;
c[k]=1;
d[k]=4;
b[k]=k+1;
}
d[1]=2;d[n]=4;

//算法===========================================================================
if(d[1]<1e-8)
{
cout<<"Method failed!";
exit(1);
}
p[1]=d[1];
q[1]=c[1]/d[1];
for(k=2;k<n-1;k++)
{
p[k]=d[k]-a[k]*q[k-1];
if(p[k]<1e-8)
{
cout<<"Method failed!";
exit(2);
}
q[k]=c[k]/p[k];
}
p[n-1]=d[n-1]-a[n-1]*q[n-2];
if(p[n-1]<1e-8)
{
cout<<"Method failed!";
exit(3);
}
y[1]=b[1]/d[1]; Iy[1]=-a[1]/d[1];
for(k=2;k<n-1;k++)
{
y[k]=(b[k]-a[k]*y[k-1])/p[k];
Iy[k]=(-a[k]*Iy[k-1])/p[k];
}
y[n-1]=(b[n-1]-a[n-1]*y[n-2])/p[n-1];
Iy[k]=(-c[n-1]-a[k]*Iy[k-1])/p[k];
x[n-1]=y[n-1]; Ix[n-1]=Iy[n-1];
for(k=n-2;k>0;k--)
{
x[k]=y[k]-q[k]*x[k+1];
Ix[k]=Iy[k]-q[k]*Ix[k+1];
}
x[n]=(b[n]-c[n]*x[1]-a[n]*x[n-1])/(c[n]*Ix[1]+a[n]*Ix[n-1]+d[n]);
for(k=1;k<n;k++)
x[k]+=Ix[k]*x[n];
outfile<<"The roots are:(";
for(k=1;k<n;k++)
outfile<<x[k]<<’,’;
outfile<<x[n]<<");
";
delete a,d,c,p,q,x,y,Iy,Ix;
// infile.close();
outfile.close();
return 0;
}
output============

The roots are:(-6.4282,2.31175,0.18121,0.963411,0.965146,1.17601,1.33083,1.50067,1.66649,1.83338,1.99999,2.16667,2.33333,2.5,2.66667,2.83333,3,3.16667,3.33333,3.5,3.66667,3.83333,4,4.16667,4.33333,4.5,4.66667,4.83333,5,5.16667,5.33333,5.5,5.66667,5.83333,6,6.16667,6.33333,6.5,6.66666,6.83334,6.99997,7.16677,7.33293,7.5015,7.66108,7.85418,7.92219,8.45706,7.24957,12.5447);

Gauss-Jordan列主元消去法

#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
#include <math.h>
#define a(u,v) a[(u)*n+(v)-w]

void main()
{//-----------------------文件流----------------------------
char filename1[256],filename2[256];
cout<<"Enter the path to input file:";
cin>>filename1;
cout<<"Enter the path to output file:";
cin>>filename2;
ifstream infile(filename1,ios::in|ios::nocreate);
ofstream outfile(filename2);
if(!infile)
{
cout<<"Can not open input file:"<<filename1<<’
’;
exit(1);
}
//----------------------变量定义----------------------------
int n,w,k,i,j;
int *p;

double *a;
double t;
//------------------------输入------------------------------
infile>>n;
w=n+1;

p=new int[w];
a=new double[n*n];

for(i=0;i<n*n;i++)
infile>>a[i];

//------------------------算法------------------------------
for(k=1;k<w;k++) //step 1
{ p[k]=k;
for(i=k;i<w;i++) //step 2
{
if(fabs(a(i,k))>fabs(a(p[k],k))) p[k]=i;
}

if(a(p[k],k)<1e-10) //step 3
{
cout<<"A is singular!"<<endl;
exit(1);
}
if(p[k]!=k) //step 4
for(i=1;i<w;i++)
{
t=a(k,i);
a(k,i)=a(p[k],i);
a(p[k],i)=t;
}
a(k,k)=1/a(k,k); //step 5
for(i=1;i<w;i++)
if(i!=k)
a(i,k)*=(-a(k,k)); //step 6
for(i=1;i<w;i++) //step 7
if(i!=k)
for(j=1;j<w;j++)
if(j!=k)
a(i,j)+=a(i,k)*a(k,j);
for(j=1;j<w;j++) //step 8
if(j!=k)
a(k,j)*=a(k,k);
}
for(k=n;k>0;k--) //step 9
if(k!=p[k])
for(i=1;i<w;i++)
{
t=a(i,k);
a(i,k)=a(i,p[k]);
a(i,p[k])=t;
}
outfile<<"各步主行行号依次为::";
for(i=1;i<w;i++)
outfile<<p[i]<<’ ’;

outfile<<"
A的逆矩阵为:
"; //step 10
for(i=1;i<w;i++)
{
for(j=1;j<w;j++)
outfile<<a(i,j)<<’ ’;
outfile<<’
’;
}

delete a,p;

infile.close();
outfile.close();
}
input=================

10
1 2 3 4 5 6 7 8 9 10
2 3 4 5 6 7 8 9 10 1
3 4 5 6 7 8 9 10 1 2
4 5 6 7 8 9 10 1 2 3
5 6 7 8 9 10 1 2 3 4
6 7 8 9 10 1 2 3 4 5
7 8 9 10 1 2 3 4 5 6
8 9 10 1 2 3 4 5 6 7
9 10 1 2 3 4 5 6 7 8
10 1 2 3 4 5 6 7 8 9

output=================

各步主行行号依次为::10 9 8 7 6 6 7 8 9 10
A的逆矩阵为:
-0.0981818 0.00181818 0.00181818 0.00181818 0.00181818 0.00181818 0.00181818 0.00181818 0.00181818 0.101818
0.00181818 0.00181818 0.00181818 0.00181818 0.00181818 0.00181818 0.00181818 0.00181818 0.101818 -0.0981818
0.00181818 0.00181818 0.00181818 0.00181818 0.00181818 0.00181818 0.00181818 0.101818 -0.0981818 0.00181818
0.00181818 0.00181818 0.00181818 0.00181818 0.00181818 0.00181818 0.101818 -0.0981818 0.00181818 0.00181818
0.00181818 0.00181818 0.00181818 0.00181818 0.00181818 0.101818 -0.0981818 0.00181818 0.00181818 0.00181818
0.00181818 0.00181818 0.00181818 0.00181818 0.101818 -0.0981818 0.00181818 0.00181818 0.00181818 0.00181818
0.00181818 0.00181818 0.00181818 0.101818 -0.0981818 0.00181818 0.00181818 0.00181818 0.00181818 0.00181818
0.00181818 0.00181818 0.101818 -0.0981818 0.00181818 0.00181818 0.00181818 0.00181818 0.00181818 0.00181818
0.00181818 0.101818 -0.0981818 0.00181818 0.00181818 0.00181818 0.00181818 0.00181818 0.00181818 0.00181818
0.101818 -0.0981818 0.00181818 0.00181818 0.00181818 0.00181818 0.00181818 0.00181818 0.00181818 0.00181818

逐次线性

#include<iostream.h>
#include<fstream.H>
#include<math.h>
#include<stdlib.h>

#define q(a,b) q[(a)*(a+1)/2+b]
#define p(a,b) q[a+1+(b)*(b+1)/2]

ifstream infile("in.txt");
ofstream outfile("out.txt");

double *x,*f,*q,root;
int n,i,j,k;

void indata()
{
infile>>n;
x=new double[n];
f=new double[n];
q=new double[(n+2)*(n+1)/2];
for(i=0;i<=n;i++) infile>>x[i]>>f[i];
infile>>root;
}

void neville()
{
for(i=0;i<=n;i++)
{
q(i,0)=f[i];
for(k=1;k<=i;k++)
q(i,k)=((root-x[i-k])*q(i,k-1)-(root-x[i])*q(i-1,k-1))/(x[i]-x[i-k]);
if(fabs(q(i,i)-q(i-1,i-1))<1e-10)
break;
}
if(i>n) i--;
outfile<<"Neville:"<<q(i,i)<<endl;
}
void aitken()
{
for(i=1;i<=n;i++)
{
p(0,i)=f[0]+(root-x[0])*(f[i]-f[0])/(x[i]-x[0]);
for(j=1;j<i;j++)
p(j,i)=p(j-1,j)+(root-x[j])*(p(j-1,i)-p(j-1,j))/(x[i]-x[j]);
if(fabs(p(i,i)-p(i-1,i-1))<1e-10)
break;
}
if(i>n) i--;
outfile<<endl<<"Aitken:"<<p(i-1,i)<<endl;
}

void mine()
{

q(0,0)=f[0];
for(i=1;i<=n;i++)
{ q(i,0)=f[i];
q(i,1)=1/(x[0]-x[i])*((root-x[i])*f[0]-(root-x[0])*f[i]);

for(k=2;k<=i;k++)
q(i,k)=-1/(x[i-k+1]-x[i])*((root-x[i-k+1])*q(i,k-1)-(root-x[i])*q(i-1,k-1));
if(fabs(q(i,i)-q(i-1,i-1))<1e-10)
break;
}
if(i>n) i--;
outfile<<endl<<"mine:"<<q(i,i)<<endl;
}

int main()
{
indata();
neville();
aitken();
mine();
return 0;
}
input===============

4
-2 0.04
-1 0.2
0 1
1 5
2 25
0.5

output==============

Neville:2.04

Aitken:2.04

mine:2.04

Newton均匀插值多项式

#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>

#define Q(a,b) Q[(a)*(a+1)/2+b]

ifstream infile("in.txt");
ofstream outfile("out.txt");

int n,i,j;
double *x,*root,*Q,*b;

void input()
{
infile>>n;
x=new double[n];
root=new double[n-1];
b=new double[n];
Q=new double[n*(n+1)/2];

for(i=0;i<n;i++)
{
infile>>x[i]>>Q(i,0);
}
}

void setroot()
{
double t;
for(i=0;i<n;i++)
for(j=i;j<n;j++)
if(x[j]<x[i])
{
t=x[j];
x[j]=x[i];
x[i]=t;
t=Q(j,0);
Q(j,0)=Q(i,0);
Q(i,0)=t;
}
for(i=0;i<n-1;i++)
{
root[i]=(x[i]+x[i+1])/2;
}

}

void Newton()
{
for(i=1;i<n;i++)
for(j=1;j<=i;j++)
Q(i,j)=(Q(i,j-1)-Q(i-1,j-1))/(x[i]-x[i-j]);
b[n-1]=Q(n-1,n-1);
}

void f(double x0)
{
for(i=n-1;i>0;i--)
b[i-1]=Q(i-1,i-1)+b[i]*(x0-x[i-1]);
outfile<<"f("<<x0<<")的近似值为:"<<b[0]<<endl;
}

void main(void)
{
input();
setroot();
Newton();
outfile<<"差分表为:"<<endl;
for(i=0;i<n;i++)
{ outfile<<i<<’ ’<<x[i]<<’ ’;
for(j=0;j<=i;j++)
outfile<<Q(i,j)<<’ ’;
outfile<<endl;
}

for(j=0;j<n-1;j++)
f(root[j]);

delete x,b,Q,root;
infile.close();
outfile.close();
}

input===============

7
-3 -4.5
6 2.1
-1 -3.2
5 2.8
-2 -1.8
3 1.7
0 0.5

output==============

差分表为:
0 -3 -4.5
1 -2 -1.8 2.7
2 -1 -3.2 -1.4 -2.05
3 0 0.5 3.7 2.55 1.53333
4 3 1.7 0.4 -0.825 -0.675 -0.368056
5 5 2.8 0.55 0.03 0.1425 0.116786 0.0606052
6 6 2.1 -0.7 -0.416667 -0.0744444 -0.0309921 -0.0184722 -0.00878638
f(-2.5)的近似值为:-1.06517
f(-1.5)的近似值为:-3.0675
f(-0.5)的近似值为:-1.86002
f(1.5)的近似值为:5.90552
f(4)的近似值为:-0.577778
f(5.5)的近似值为:4.59237

变步长的Simpson求积法

#include<iostream.h>
#include<fstream.h>
#include<math.h>
#include<stdlib.h>

ifstream infile("in.dat");
ofstream outfile("out.out ");

double a[3],b[3];
int i,m[3],k;

void indata()
{
for(i=0;i<3;i++)
infile>>a[i]>>b[i]>>m[i];
m[i]/=2;
}

double cal0(double x)
{
return (6*exp(-x*x));
}

double cal1(double x)
{
return (3*log(x));
}

double cal2(double x)
{
return (sin(x)/x);
}

void simpson(double a,double b,int m,double (*g)(double))
{
double h[3],q[3],p[3],s[3],t;

h[0]=(b-a)/(2*m);
t=0;
for(i=1;i<m+1;i++)
t+=(g(a+(2*i-1)*h[0])+g(a+2*i*h[0]));
p[0]=g(a)-g(b)+2*t;
t=0;
for(i=1;i<m+1;i++)
t+=g(a+(2*i-1)*h[0]);
s[0]=h[0]*(p[0]+2*t)/3;

h[1]=h[0]/2;
q[0]=0;
for(i=1;i<2*m+1;i++)
q[0]+=g(a+(2*i-1)*h[1]);
s[1]=h[1]*(p[0]+4*q[0])/3;
h[2]=h[1]/2;
q[1]=0;
for(i=1;i<pow(2,2)*m+1;i++)
q[1]+=g(a+(2*i-1)*h[2]);
p[1]=p[0]+2*q[0];
s[2]=h[2]*(p[1]+4*q[1])/3;
for(k=2;;k++)
{
h[(k+1)%3]=(b-a)/(pow(2,k+2)*m);
q[k%3]=0;
for(i=1;i<pow(2,k+1)*m+1;i++)
q[k%3]+=g(a+(2*i-1)*h[(k+1)%3]);
p[k%3]=p[(k-1)%3]+2*q[(k-1)%3];
s[(k+1)%3]=h[(k+1)%3]*(p[k%3]+4*q[k%3])/3;
if(s[(k+1)%3]-s[k%3]<1e-7)
{ t=s[(k+1)%3];
break;
}
}
outfile<<t<<endl;
outfile<<"积分区间数目为:"<<pow(2,k+1)*m<<endl;
}

void main()
{
indata();

outfile<<"I("<<1<<")=";
simpson(a[0],b[0],m[0],cal0);

outfile<<"I("<<2<<")=";
simpson(a[1],b[1],m[1],cal1);

outfile<<"I("<<3<<")=";
simpson(a[2],b[2],m[2],cal2);

infile.close();
outfile.close();
}

input==================

0 1 2
1 2 2
1 4 2

output=================

I(1)=4.48094
积分区间数目为:16
I(2)=1.15888
积分区间数目为:32
I(3)=0.81212
积分区间数目为:32

Exam!

昨天考完了六级,明天又有概率论的考试,复习的好辛苦。

到期末了才发现原来以为很难的东西并不是不能克服,大数定律、中心极限定理那么不清不楚的家伙其实也是很明了的。唉,不知道为什么正常上课的时候看不懂。也许没那个环境吧,平时看不懂就可以放掉,到考试了,看不懂就要挂,当然要努力理解了。

考完复变晚上头很痛,上了会儿网,QQ上人倒是不少,没有聊天的欲望。一个哥们向我诉苦,说复变又没考好,觉得很失败。我何尝不是,好象对分析学没有感觉似的,错的莫名其妙,老师改的又严,不知道结果会怎么样,不过期末比期中感觉好多了,希望分数不要太差。

学校有空调的地方少的可怜,自习热的不行,教室里风扇风挺大,可居然连蚊子都扇不走,咬得身上很多包。无奈就回来洗洗澡,降一下温。

唉,苦命的数学系学生,非常想学好,可数学这个东西对我来说怎么那么艰苦呢。

还有三门,24号就能考完回家了。虽然有些讨厌在家那种无所事事的感觉,可不用操心那么多事还是挺让人向往的。开学就该大三了,离自己要独立越来越近了,中午睡觉的时候想了一下,还是蛮吓人的。过惯了有人照顾的生活,很难想象自己一个人奋斗的艰苦。可是,路,还是得走下去呀!

Shit exam!And,bless me exam!

接着去自习~~

我的太阳

我把我生命中珍贵的、易失去的东西都称做我的太阳。因为它们,我的生命充满了快乐的光芒,虽然阴霾并不是荡然无存,但是,快乐过,就足够庆幸了。
不可否认的是,我应该非常感激上天赐给了我很多的幸福。人生像一个找寻幸福的过程,前方完全是个未知数,也没有可以估计的期望,渐渐地由孩子而成人而老去,似乎没人有觉得自己的幸福是全世界的最大值。我也一样,人性的本质给了我一颗蒙尘的心,永远不知道满足。常常在想,我到底需要什么呢?

也许这是一个非常沉重的话题,这个月的《萌芽》上有一篇文章说,一个男孩告诉别人,他追求的是爱情,但是在有爱情之前得先打好基础。但他却是清华的学生,已经保送研究生,也不知道他指的打好基础是什么。文章说,等你准备好一切然后去追求你的女孩时,她也许已经在别人的怀抱了。这句话让我想了好久。

我曾经天真的以为我喜欢的女孩和我的想法一样,可以平平淡淡的分享一份稳定的爱情,可是事实证明,像好朋友的个性签名说的,这个世界远不像你想的那样。然后,我渐渐明白了,一个男人还应该有自己的责任,应该有一个能给得起承诺的基础,就开始吝惜自己的感情了。既然给不起别人,就不要期望可以有回报。换用我自称帅哥室友的一句话,可能极端了点,这年头,帅顶个屁用,男人要有钱。

直至现在我也不知道我到底做得对不对。大一的时候日子过得很平淡,由于对数学不怎么感兴趣,心中也有一份期待,学习以外的爱好就是运动运动,看看闲书。我的朋友就说,很羡慕你的,有那么随心的生活。等到军训后的那个暑假,受到打击之后才发现,自己什么也不是,虽然从小功利心就不是那么的强,还是被一种强烈的自卑撞击得体无完肤。就连暑假也过得不顺利,倒霉到能在马路上碰巧撞到一个篮球,而且伤口到开学才长好。大二为了让自己生活中的一块被填补上,便把自己投入到各种活动中去,把本来可以大一就应该体验到的东西尝试了一遍。时间是疗伤很好的工具,在忙碌中渐渐淡忘。虽然不可以完全无动于衷了,可是至少可以做到平静的生活,偶尔会听到一些消息,全当作一个好朋友罢默默的祝福。

整个大学时代已经没有什么好期待的了,我认为我的感情生活在大学已经成了死水一潭,没可能再有什么波澜。为了不让它那么索然无味的过去,也是受了一位学长的鼓动,就打定了决心出国,虽然成绩并不是很理想,但是还是过得去那种,可以试试,况且还有一年多时间。然后在系里做得还行,因为学生工作的缘故也认识了许多朋友,再次恢复了往日那种自信,虽然学习也没什么起色。生活也渐渐地趋于规则化,况且有学校的身处市郊,与世无争的清净,也可以说是安逸了。

无论如何是舍不得的,我也不想回避这一点。但是一切真能像我期待的那样走下去吗?我常常问自己。我不知道,不知道将来,不知道该如何去做。记得好象是柳传志说过,如果不知道下面该做什么,先把手头的事情做好。可是我发现自己居然是那么的幼稚,连现在该怎么做都不知道。在感情方面,我还只是个不谙世事的孩子,把一切看得像童话般简单,可事实把理想一个一个撞得粉碎。现在的我,依然过着原来的生活,依然渴望平平淡淡波澜不惊,只是某些时候加了一些期待,加了一些对未来的憧憬。正如志摩之言:“我将于茫茫人海中访我唯一灵魂之伴侣;得之,我幸;不得,我命,如此而已。”