> 文章列表 > 【数据结构实验】文本格式化

【数据结构实验】文本格式化

【数据结构实验】文本格式化

【数据结构实验】文本格式化

简介

按照用户指定版面规格重新排版,实现页面调整、分段、分页等文本处理功能,排版结果输出文本文件中。

需求分析

  1. “字”定义:字是一行中不含空格符最长子串,例如“good!”算一个字。
  2. 文本格式化程序可以处理待格式化的文本,按照用户需求重新排版,也可以实现缺省值。
  3. 文本中字与字之间只保留一个空格符,即实现多余空格符的压缩。

概要设计

  1. 串的抽象数
ADT String {
数据对象:D={ai | ai∈CharacterSet, i=1,2,...,n, n≥0}
数据关系:R1={ <ai-1 , ai> | , ai-1,ai∈D, i=2,...,n }
基本操作StrAssign (&T, chars)
初始条件:chars 是串常量。
操作结果:赋于串T的值为 chars。
StrCopy (&T, S)
初始条件:串 S 存在
操作结果:由串 S 复制得串 T。
DestroyString (&S)
初始条件:串 S 存在。
操作结果:串 S 被销毁。
StrEmpty (S)
初始条件:串 S 存在。
操作结果:若 S 为空串,则返回 TRUE,否则返回 FALSE。
StrCompare(S, T)
初始条件:串 S 和 T 存在。
操作结果:若S>T,则返回值=0;若S=T,则返回值<0;若S<T,则返回值<0StrLength (S)
初始条件:串 S 存在。
操作结果:返回串 S 序列中的字符个数,即串的长度。
ClearString (&S)
初始条件:串 S 存在。
操作结果:将 S 清为空串。
Concat(&T, S1, S2)
初始条件:串 S1 和 S2 存在。
操作结果:用 T 返回由 S1 和 S2 联接而成的新串。
SubString(&Sub, S, pos, len)
初始条件:串S存在,1≤pos≤StrLength(S)0≤len≤StrLength(S)-pos+1。
操作结果:用 Sub 返回串S的第 pos 个字符起长度为 len 的子串。
Index (S, T,pos)
初始条件:串S和T存在,T 是非空串,1≤pos≤StrLength(S)。
操作结果:若主串S中存在和串T值相同的子串,则返回它在主串S中第pos个字符之后第一次出现的位置;否则函数值为0Replace(&S, T, V)
初始条件:串 S,T 和 V 存在,T 是非空串。
操作结果:用V替换主串S中出现的所有与T相等的不重叠的子串。
StrInsert(&S, pos, T)
初始条件:串 S 和 T 存在,1≤pos≤StrLength(S)1。
操作结果:在串 S 的第 pos 个字符之前插入串 T。
StrDelete (&S, pos, len)
初始条件:串 S 存在,1≤pos≤StrLength(S)-len+1。
操作结果:从串 S 中删除第 pos 个字符起长度为 len 的子串。
} ADT String
  1. 本程序包含3个模块:

1)主程序模块

int main()
{初始化;接受命令;处理命令;}

2)文本处理模块—读取文本中的字符并处理
3)缩进、空格生成模块

  1. 本程序包含3个模块:

详细设计

  1. 文本格式化的默认参数
int PageLength=55;
int PageWedth=60;
int LeftMargin=10;
int HeadingLength=5;
int FootingLength=5;
int StartingPageNumber=1;
  1. 所调用函数的声明
void makespace(FILE *fs,int spacenum);
//生成空格
void makeheading(FILE *fs,int line,int& linenum);
//生成页眉
void makefooting(FILE *fs,int line,int& linenum,int &pagenum);
//生成页脚和页码
Status ReadText(char* readfilename,char* savefilename);
//文本读取函数

3)完整代码:

/*头文件*/ 
#include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<string.h>
#include<math.h>
using namespace std;
typedef int Status;/*宏定义*/
#define OK 1
#define TRUE 1
#define ERROR 0
#define FALSE -1
#define MaxWordSize 50/*默认参数*/
int PageLength=55;
int PageWedth=60;
int LeftMargin=10;
int HeadingLength=5;
int FootingLength=5;
int StartingPageNumber=1;/*函数声明*/
void makespace(FILE *fs,int spacenum);
void makeheading(FILE *fs,int line,int& linenum);
void makefooting(FILE *fs,int line,int& linenum,int &pagenum);
Status ReadText(char* readfilename,char* savefilename);
void printOut();
int main()
{cout<<"-------------------------欢迎使用文本编辑器----------------------------------"<<endl;printOut();cout<<"是否需要修改参数?(Y/N)"<<endl;char judge;cin>>judge;int choice;if(judge=='Y'){while(1){cout<<"需要修改哪项"<<endl;printf("1.页长:\\n");printf("2.页宽:\\n");printf("3.左空白:\\n");printf("4.头长:\\n");printf("5.脚长:\\n");printf("6.起始页号:\\n");printf("7.返回:\\n");cin>>choice;if(choice==7) break;switch(choice){case 1:printf("1.页长:\\n");cin>>PageLength;break;case 2:printf("2.页宽:\\n");cin>>PageWedth;break;case 3:printf("3.左空白:\\n");cin>>LeftMargin;break;case 4:printf("4.头长:\\n");cin>>HeadingLength;break;case 5:printf("5.脚长:\\n");cin>>FootingLength;break;case 6:printf("6.起始页号:\\n");cin>>StartingPageNumber;break;default:cout<<"输入错误"<<endl;}} }fflush(stdin);cout<<"按任意键开始对指定文件格式化"<<endl;getchar();char *readfilename,*savefilename;readfilename=new char[MaxWordSize];savefilename=new char[MaxWordSize];strcpy(readfilename,"待格式化文本.txt");strcpy(savefilename,"已格式化文件.txt");ReadText(readfilename,savefilename);
}void printOut()	//输出头文件中的所有整形变量
{	
//这个函数中的参数全部来自头文件printf("\\n");printf("版面的参数如下:\\n");printf("页长:%d\\n",PageLength);printf("页宽:%d\\n",PageWedth);printf("左空白:%d\\n",LeftMargin);printf("头长:%d\\n",HeadingLength);printf("脚长:%d\\n",FootingLength);printf("起始页号:%d\\n",StartingPageNumber);printf("\\n");printf("本程序只支持英文格式化\\n");printf("\\n");
}Status ReadText(char* readfilename,char* savefilename)
{FILE *fp,*fs;int wordnum=0;int linenum=1;int pagenum=StartingPageNumber;char temp[MaxWordSize];char prev[MaxWordSize];if(((fp=fopen(readfilename,"r"))==NULL)||((fs=fopen(savefilename,"w+"))==NULL)){cout<<"打开文件失败"<<endl;return ERROR;}makeheading(fs,HeadingLength,linenum);makespace(fs,8);makespace(fs,LeftMargin);while(fscanf(fp,"%s",temp)!=EOF){if(strcmp(temp,"@")==0){printf("\\n");fprintf(fs,"\\n");linenum++;makespace(fs,8);makespace(fs,LeftMargin);wordnum=0;strcpy(prev,temp);continue;}wordnum+=strlen(temp);if(wordnum>PageWedth){printf("\\n");fprintf(fs,"\\n");wordnum=0;makespace(fs,LeftMargin);linenum++;}	if(linenum+FootingLength==PageLength){makefooting(fs,FootingLength,linenum,pagenum);makeheading(fs,HeadingLength,linenum);linenum=0;makespace(fs,LeftMargin);wordnum=0;if(strcmp(prev,"@")==0){makespace(fs,8);strcpy(prev,"#");}  	}printf("%s ",temp);fprintf(fs,"%s ",temp);strcpy(prev,temp);}printf("\\n");fprintf(fs,"\\n");if(FootingLength>=3){makefooting(fs,FootingLength,linenum, pagenum);}fclose(fp);fclose(fs);
}void makespace(FILE *fs,int spacenum)
{char space=' ';for(int i=0;i<spacenum;i++){printf("%c",space);fprintf(fs,"%c",space);}
}void makeheading(FILE *fs,int line,int &linenum)
{for(int i=0;i<line;i++){printf("\\n");fprintf(fs,"\\n");linenum++;}
}void makefooting(FILE *fs,int line,int &linenum,int &pagenum)
{for(int i=0;i<line;i++){if(i==1&&line>=3){makespace(fs,8+LeftMargin+PageWedth/2);printf("%d\\n",pagenum);fprintf(fs,"\\t%d\\n",pagenum);continue;}printf("\\n");fprintf(fs,"\\n");linenum++;}pagenum++;
}

调试分析

  1. 在最初的调试过程中,出现文件打开失败的情况,经过检查是文件操作时打开文件的类型没有选对,应该在以后注意避免这种情况的发生。
  2. 在能够排本文本后,在分页、分段的位置出现了一些小问题。主要是在每次读取一个字符的时候,应当捋清楚判断是否应该换行、是否应该分段与是否应当分页的逻辑关系与先后顺序,否则会容易出现bug。
  3. 注意应该将原文本中的分段符“@”删去,同时完成分段操作。
    五、 用户手册
    1.进入页面后,用户可以看到初始的参数,并选择是否修改:
-------------------------欢迎使用文本编辑器----------------
版面的参数如下:
页长:55
页宽:60
左空白:10
头长:5
脚长:5
起始页号:1
本程序只支持英文格式化
是否需要修改参数?(Y/N)

2.完成选择或修改后,按任意键,即可开始格式化。格式化的结果会输出在屏幕上,同时会保存到文件“已格式化文件.txt”中。

测试结果

在“待格式化文本.txt”中,有以下内容:

I say to      you today,      my friends, that in spite     of the     difficulties     and      frustrations of the moment, I still have a dream. It is a dream deeply rooted in the American dream. @ I have a dream that one day this nation will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident:     that all men are created equal." @ I have a dream that one day on the red hills of Georgia the sons of former slaves and the sons of former slaveowners will be able to sit down together at a table of brotherhood. @ I have a dream that one day even the state of Mississippi, a desert state, sweltering with the heat of injustice and oppression, will be transformed into an oasis of freedom and justice. @ I have a dream that my four children will one day live in a nation where they will not be judged by the color of their skin but by the content of their character. @ I have a dream today.I say to you today, my friends, that in spite of the difficulties and frustrations of the moment, I still have a dream. It is a dream deeply rooted in the American dream. @ I have a dream that one day this nation will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident: that all men are created equal." @ I have a dream that one day on the red hills of Georgia the sons of former slaves and the sons of former slaveowners will be able to sit down together at a table of brotherhood. @ I have a dream that one day even the state of Mississippi, a desert state, sweltering with the heat of injustice and oppression, will be transformed into an oasis of freedom and justice. @ I have a dream that my four children will one day live in a nation where they will not be judged by the color of their skin but by the content of their character. @ I have a dream today.I say to you today, my friends, that in spite of the difficulties and frustrations of the moment, I still have a dream. It is a dream deeply rooted in the American dream. @ I have a dream that one day this nation will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident: that all men are created equal." @ I have a dream that one day on the red hills of Georgia the sons of former slaves and the sons of former slaveowners will be able to sit down together at a table of brotherhood. @ I have a dream that one day even the state of Mississippi, a desert state, sweltering with the heat of injustice and oppression, will be transformed into an oasis of freedom and justice. @ I have a dream that my four children will one day live in a nation where they will not be judged by the color of their skin but by the content of their character. @ I have a dream today.I say to you today, my friends, that in spite of the difficulties and frustrations of the moment, I still have a dream. It is a dream deeply rooted in the American dream. @ I have a dream that one day this nation will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident: that all men are created equal." @ I have a dream that one day on the red hills of Georgia the sons of former slaves and the sons of former slaveowners will be able to sit down together at a table of brotherhood. @ I have a dream that one day even the state of Mississippi, a desert state, sweltering with the heat of injustice and oppression, will be transformed into an oasis of freedom and justice. @ I have a dream that my four children will one day live in a nation where they will not be judged by the color of their skin but by the content of their character. @ I have a dream today.I say to you today, my friends, that in spite of the difficulties and frustrations of the moment, I still have a dream. It is a dream deeply rooted in the American dream. @ I have a dream that one day this nation will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident: that all men are created equal." @ I have a dream that one day on the red hills of Georgia the sons of former slaves and the sons of former slaveowners will be able to sit down together at a table of brotherhood. @ I have a dream that one day even the state of Mississippi, a desert state, sweltering with the heat of injustice and oppression, will be transformed into an oasis of freedom and justice. @ I have a dream that my four children will one day live in a nation where they will not be judged by the color of their skin but by the content of their character. @ I have a dream today.I say to you today, my friends, that in spite of the difficulties and frustrations of the moment, I still have a dream. It is a dream deeply rooted in the American dream. @ I have a dream that one day this nation will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident: that all men are created equal." @ I have a dream that one day on the red hills of Georgia the sons of former slaves and the sons of former slaveowners will be able to sit down together at a table of brotherhood. @ I have a dream that one day even the state of Mississippi, a desert state, sweltering with the heat of injustice and oppression, will be transformed into an oasis of freedom and justice. @ I have a dream that my four children will one day live in a nation where they will not be judged by the color of their skin but by the content of their character. @ I have a dream today.I say to you today, my friends, that in spite of the difficulties and frustrations of the moment, I still have a dream. It is a dream deeply rooted in the American dream. @ I have a dream that one day this nation will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident: that all men are created equal." @ I have a dream that one day on the red hills of Georgia the sons of former slaves and the sons of former slaveowners will be able to sit down together at a table of brotherhood. @ I have a dream that one day even the state of Mississippi, a desert state, sweltering with the heat of injustice and oppression, will be transformed into an oasis of freedom and justice. @ I have a dream that my four children will one day live in a nation where they will not be judged by the color of their skin but by the content of their character. @ I have a dream today.I say to you today, my friends, that in spite of the difficulties and frustrations of the moment, I still have a dream. It is a dream deeply rooted in the American dream. @ I have a dream that one day this nation will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident: that all men are created equal." @ I have a dream that one day on the red hills of Georgia the sons of former slaves and the sons of former slaveowners will be able to sit down together at a table of brotherhood. @ I have a dream that one day even the state of Mississippi, a desert state, sweltering with the heat of injustice and oppression, will be transformed into an oasis of freedom and justice. @ I have a dream that my four children will one day live in a nation where they will not be judged by the color of their skin but by the content of their character. @ I have a dream today.I say to you today, my friends, that in spite of the difficulties and frustrations of the moment, I still have a dream. It is a dream deeply rooted in the American dream. @ I have a dream that one day this nation will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident: that all men are created equal." @ I have a dream that one day on the red hills of Georgia the sons of former slaves and the sons of former slaveowners will be able to sit down together at a table of brotherhood. @ I have a dream that one day even the state of Mississippi, a desert state, sweltering with the heat of injustice and oppression, will be transformed into an oasis of freedom and justice. @ I have a dream that my four children will one day live in a nation where they will not be judged by the color of their skin but by the content of their character. @ I have a dream today.I say to you today, my friends, that in spite of the difficulties and frustrations of the moment, I still have a dream. It is a dream deeply rooted in the American dream. @ I have a dream that one day this nation will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident: that all men are created equal." @ I have a dream that one day on the red hills of Georgia the sons of former slaves and the sons of former slaveowners will be able to sit down together at a table of brotherhood. @ I have a dream that one day even the state of Mississippi, a desert state, sweltering with the heat of injustice and oppression, will be transformed into an oasis of freedom and justice. @ I have a dream that my four children will one day live in a nation where they will not be judged by the color of their skin but by the content of their character. @ I have a dream today.I say to you today, my friends, that in spite of the difficulties and frustrations of the moment, I still have a dream. It is a dream deeply rooted in the American dream. @ I have a dream that one day this nation will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident: that all men are created equal." @ I have a dream that one day on the red hills of Georgia the sons of former slaves and the sons of former slaveowners will be able to sit down together at a table of brotherhood. @ I have a dream that one day even the state of Mississippi, a desert state, sweltering with the heat of injustice and oppression, will be transformed into an oasis of freedom and justice. @ I have a dream that my four children will one day live in a nation where they will not be judged by the color of their skin but by the content of their character. @ I have a dream today.I say to you today, my friends, that in spite of the difficulties and frustrations of the moment, I still have a dream. It is a dream deeply rooted in the American dream. @ I have a dream that one day this nation will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident: that all men are created equal." @ I have a dream that one day on the red hills of Georgia the sons of former slaves and the sons of former slaveowners will be able to sit down together at a table of brotherhood. @ I have a dream that one day even the state of Mississippi, a desert state, sweltering with the heat of injustice and oppression, will be transformed into an oasis of freedom and justice. @ I have a dream that my four children will one day live in a nation where they will not be judged by the color of their skin but by the content of their character. @ I have a dream today.I say to you today, my friends, that in spite of the difficulties and frustrations of the moment, I still have a dream. It is a dream deeply rooted in the American dream. @ I have a dream that one day this nation will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident: that all men are created equal." @ I have a dream that one day on the red hills of Georgia the sons of former slaves and the sons of former slaveowners will be able to sit down together at a table of brotherhood. @ I have a dream that one day even the state of Mississippi, a desert state, sweltering with the heat of injustice and oppression, will be transformed into an oasis of freedom and justice. @ I have a dream that my four children will one day live in a nation where they will not be judged by the color of their skin but by the content of their character. @ I have a dream today.I say to you today, my friends, that in spite of the difficulties and frustrations of the moment, I still have a dream. It is a dream deeply rooted in the American dream. @ I have a dream that one day this nation will rise up and live out the true meaning of its creed: "We hold these truths to be self-evident: that all men are created equal." @ I have a dream that one day on the red hills of Georgia the sons of former slaves and the sons of former slaveowners will be able to sit down together at a table of brotherhood. @ I have a dream that one day even the state of Mississippi, a desert state, sweltering with the heat of injustice and oppression, will be transformed into an oasis of freedom and justice. @ I have a dream that my four children will one day live in a nation where they will not be judged by the color of their skin but by the content of their character. @ I have a dream today.

经过处理后,输出一下结果:

              I say to you today, my friends, that in spite of the difficulties andfrustrations of the moment, I still have a dream. It is a dream deeply rooted in theAmerican dream.I have a dream that one day this nation will rise up and live out the truemeaning of its creed: "We hold these truths to be self-evident: that all men arecreated equal."I have a dream that one day on the red hills of Georgia the sons of formerslaves and the sons of former slaveowners will be able to sit down together at atable of brotherhood.I have a dream that one day even the state of Mississippi, a desert state,sweltering with the heat of injustice and oppression, will be transformed into anoasis of freedom and justice.I have a dream that my four children will one day live in a nation wherethey will not be judged by the color of their skin but by the content of theircharacter.I have a dream today.I say to you today, my friends, that in spite of thedifficulties and frustrations of the moment, I still have a dream. It is a dream deeplyrooted in the American dream.I have a dream that one day this nation will rise up and live out the truemeaning of its creed: "We hold these truths to be self-evident: that all men arecreated equal."I have a dream that one day on the red hills of Georgia the sons of formerslaves and the sons of former slaveowners will be able to sit down together at atable of brotherhood.I have a dream that one day even the state of Mississippi, a desert state,sweltering with the heat of injustice and oppression, will be transformed into anoasis of freedom and justice.I have a dream that my four children will one day live in a nation wherethey will not be judged by the color of their skin but by the content of theircharacter.I have a dream today.I say to you today, my friends, that in spite of thedifficulties and frustrations of the moment, I still have a dream. It is a dream deeplyrooted in the American dream.I have a dream that one day this nation will rise up and live out the truemeaning of its creed: "We hold these truths to be self-evident: that all men arecreated equal."I have a dream that one day on the red hills of Georgia the sons of formerslaves and the sons of former slaveowners will be able to sit down together at atable of brotherhood.I have a dream that one day even the state of Mississippi, a desert state,sweltering with the heat of injustice and oppression, will be transformed into anoasis of freedom and justice.I have a dream that my four children will one day live in a nation wherethey will not be judged by the color of their skin but by the content of their1character.I have a dream today.I say to you today, my friends, that in spite of thedifficulties and frustrations of the moment, I still have a dream. It is a dream deeplyrooted in the American dream.I have a dream that one day this nation will rise up and live out the truemeaning of its creed: "We hold these truths to be self-evident: that all men arecreated equal."I have a dream that one day on the red hills of Georgia the sons of formerslaves and the sons of former slaveowners will be able to sit down together at atable of brotherhood.I have a dream that one day even the state of Mississippi, a desert state,sweltering with the heat of injustice and oppression, will be transformed into anoasis of freedom and justice.I have a dream that my four children will one day live in a nation wherethey will not be judged by the color of their skin but by the content of theircharacter.I have a dream today.I say to you today, my friends, that in spite of thedifficulties and frustrations of the moment, I still have a dream. It is a dream deeplyrooted in the American dream.I have a dream that one day this nation will rise up and live out the truemeaning of its creed: "We hold these truths to be self-evident: that all men arecreated equal."I have a dream that one day on the red hills of Georgia the sons of formerslaves and the sons of former slaveowners will be able to sit down together at atable of brotherhood.I have a dream that one day even the state of Mississippi, a desert state,sweltering with the heat of injustice and oppression, will be transformed into anoasis of freedom and justice.I have a dream that my four children will one day live in a nation wherethey will not be judged by the color of their skin but by the content of theircharacter.I have a dream today.I say to you today, my friends, that in spite of thedifficulties and frustrations of the moment, I still have a dream. It is a dream deeplyrooted in the American dream.I have a dream that one day this nation will rise up and live out the truemeaning of its creed: "We hold these truths to be self-evident: that all men arecreated equal."I have a dream that one day on the red hills of Georgia the sons of formerslaves and the sons of former slaveowners will be able to sit down together at atable of brotherhood.I have a dream that one day even the state of Mississippi, a desert state,sweltering with the heat of injustice and oppression, will be transformed into anoasis of freedom and justice.I have a dream that my four children will one day live in a nation wherethey will not be judged by the color of their skin but by the content of theircharacter.I have a dream today.I say to you today, my friends, that in spite of thedifficulties and frustrations of the moment, I still have a dream. It is a dream deeplyrooted in the American dream.I have a dream that one day this nation will rise up and live out the true2meaning of its creed: "We hold these truths to be self-evident: that all men arecreated equal."I have a dream that one day on the red hills of Georgia the sons of formerslaves and the sons of former slaveowners will be able to sit down together at atable of brotherhood.I have a dream that one day even the state of Mississippi, a desert state,sweltering with the heat of injustice and oppression, will be transformed into anoasis of freedom and justice.I have a dream that my four children will one day live in a nation wherethey will not be judged by the color of their skin but by the content of theircharacter.I have a dream today.I say to you today, my friends, that in spite of thedifficulties and frustrations of the moment, I still have a dream. It is a dream deeplyrooted in the American dream.I have a dream that one day this nation will rise up and live out the truemeaning of its creed: "We hold these truths to be self-evident: that all men arecreated equal."I have a dream that one day on the red hills of Georgia the sons of formerslaves and the sons of former slaveowners will be able to sit down together at atable of brotherhood.I have a dream that one day even the state of Mississippi, a desert state,sweltering with the heat of injustice and oppression, will be transformed into anoasis of freedom and justice.I have a dream that my four children will one day live in a nation wherethey will not be judged by the color of their skin but by the content of theircharacter.I have a dream today.I say to you today, my friends, that in spite of thedifficulties and frustrations of the moment, I still have a dream. It is a dream deeplyrooted in the American dream.I have a dream that one day this nation will rise up and live out the truemeaning of its creed: "We hold these truths to be self-evident: that all men arecreated equal."I have a dream that one day on the red hills of Georgia the sons of formerslaves and the sons of former slaveowners will be able to sit down together at atable of brotherhood.I have a dream that one day even the state of Mississippi, a desert state,sweltering with the heat of injustice and oppression, will be transformed into anoasis of freedom and justice.I have a dream that my four children will one day live in a nation wherethey will not be judged by the color of their skin but by the content of theircharacter.I have a dream today.I say to you today, my friends, that in spite of thedifficulties and frustrations of the moment, I still have a dream. It is a dream deeplyrooted in the American dream.I have a dream that one day this nation will rise up and live out the truemeaning of its creed: "We hold these truths to be self-evident: that all men arecreated equal."I have a dream that one day on the red hills of Georgia the sons of formerslaves and the sons of former slaveowners will be able to sit down together at atable of brotherhood.3I have a dream that one day even the state of Mississippi, a desert state,sweltering with the heat of injustice and oppression, will be transformed into anoasis of freedom and justice.I have a dream that my four children will one day live in a nation wherethey will not be judged by the color of their skin but by the content of theircharacter.I have a dream today.I say to you today, my friends, that in spite of thedifficulties and frustrations of the moment, I still have a dream. It is a dream deeplyrooted in the American dream.I have a dream that one day this nation will rise up and live out the truemeaning of its creed: "We hold these truths to be self-evident: that all men arecreated equal."I have a dream that one day on the red hills of Georgia the sons of formerslaves and the sons of former slaveowners will be able to sit down together at atable of brotherhood.I have a dream that one day even the state of Mississippi, a desert state,sweltering with the heat of injustice and oppression, will be transformed into anoasis of freedom and justice.I have a dream that my four children will one day live in a nation wherethey will not be judged by the color of their skin but by the content of theircharacter.I have a dream today.I say to you today, my friends, that in spite of thedifficulties and frustrations of the moment, I still have a dream. It is a dream deeplyrooted in the American dream.I have a dream that one day this nation will rise up and live out the truemeaning of its creed: "We hold these truths to be self-evident: that all men arecreated equal."I have a dream that one day on the red hills of Georgia the sons of formerslaves and the sons of former slaveowners will be able to sit down together at atable of brotherhood.I have a dream that one day even the state of Mississippi, a desert state,sweltering with the heat of injustice and oppression, will be transformed into anoasis of freedom and justice.I have a dream that my four children will one day live in a nation wherethey will not be judged by the color of their skin but by the content of theircharacter.I have a dream today.I say to you today, my friends, that in spite of thedifficulties and frustrations of the moment, I still have a dream. It is a dream deeplyrooted in the American dream.I have a dream that one day this nation will rise up and live out the truemeaning of its creed: "We hold these truths to be self-evident: that all men arecreated equal."I have a dream that one day on the red hills of Georgia the sons of formerslaves and the sons of former slaveowners will be able to sit down together at atable of brotherhood.I have a dream that one day even the state of Mississippi, a desert state,sweltering with the heat of injustice and oppression, will be transformed into anoasis of freedom and justice.I have a dream that my four children will one day live in a nation wherethey will not be judged by the color of their skin but by the content of their4character.I have a dream today.I say to you today, my friends, that in spite of thedifficulties and frustrations of the moment, I still have a dream. It is a dream deeplyrooted in the American dream.I have a dream that one day this nation will rise up and live out the truemeaning of its creed: "We hold these truths to be self-evident: that all men arecreated equal."I have a dream that one day on the red hills of Georgia the sons of formerslaves and the sons of former slaveowners will be able to sit down together at atable of brotherhood.I have a dream that one day even the state of Mississippi, a desert state,sweltering with the heat of injustice and oppression, will be transformed into anoasis of freedom and justice.I have a dream that my four children will one day live in a nation wherethey will not be judged by the color of their skin but by the content of theircharacter.I have a dream today.5