cpp: read .dat file

 

/// <summary>
/// 打开DAT 文件
/// </summary>
void operatefile()
{
	char data[100];
	const char* fname = "afile.dat";
	// 打开文件.
	ofstream outfile;
	outfile.open(fname,ios::app); //从文件尾添加 ios::in
	if (!outfile)
	{
		cout << "文件不存在!" << endl;
		ofstream fout(fname); //创建文件
	}

	cout << "写文件" << endl;
	cout << "输入姓名: ";
	cin.getline(data, 100);

	// 写入.
	outfile << data << endl;

	cout << "输入年龄: ";
	cin >> data;
	cin.ignore();

	// 写入.
	outfile << data << endl;

	// 关闭文件.
	outfile.close();

	// 打开文件.
	ifstream infile;
	infile.open("afile.dat");


	cout << "读文件内容:" << endl;
	for (int i = 0; i < 4; i++) {

		infile >> data;
		// 
		cout <<"姓名:"<< data << endl;
		// 
		infile >> data;
		cout <<"年龄:"<< data << endl;
	}




	// 关闭文件
	infile.close();
}

  

人们认识事物有两个途径,一种是通过直接实践获取经验,称为直接经验;另一种是通过间接实践获取经验,称为间接经验。

布卢姆在《教育目标分类学》中认为知识是“对具体事物和普遍原理的回忆,对方法和过程的回忆,或者对一种模式、结构或框架的回忆”,这是从知识所包含的内容的角度说的,属于一种现象描述。

从哲学认识论的角度,《中国大百科全书》“知识”条目是这样表述的:“所谓知识,就它反映的内容而言,是客观事物的属性与联系的反映,是客观世界在人脑中的主观映象。就它的反映活动形式而言,有时表现为主体对事物的感性知觉或表象,属于感性知识,有时表现为关于事物的概念或规律,属于理性知识。

联合国经济合作与发展组织(OECD)在《以知识为基础的经济报告》中,将知识分为四大类:

第一类是知道是什么的知识,即知事(Know-What,又称事实知识),指的是关于历史事实、经验总结、统计数据的知识。
第二类是知道为什么的知识,即知因(Know-Why,又称原理知识),指的是那些自然、社会和人的思维运动的法则、规律等科学知识。
第三类是知道怎样做的知识,即知窍(Know-How,又称技能知识),是指做某些事情的技巧和能力。
第四类是知道是谁的知识,即知人(Know-who,又称人力知识),指的是人际关系的知识。
其中前两类知识属于显性知识,而后两类属于隐性知识。

double timeSquare()
{
	clock_t start, end;//定义clock_t变量
	double t;
	DWORD t1, t2;
	t1 = GetTickCount();
	start = clock();//开始时间

	funcSquare();

	end = clock();//结束时间

	cout << "time = " << double(end - start) / CLOCKS_PER_SEC << "s" << endl;  //输出时间(单位:s)
	t2 = GetTickCount();
	cout << "time = " << ((t2 - t1) * 1.0 / 1000) << "s" << endl;  //输出时间(单位:s)
	t =  double(end - start) / CLOCKS_PER_SEC;//((t2 - t1) * 1.0 / 1000);//
	return t;
}

double timeFunc()
{
	clock_t start, end;//定义clock_t变量
	double t;
	start = clock();//开始时间
	DWORD t1, t2;
	t1 = GetTickCount();
	func();

	end = clock();//结束时间
	
	cout << "time = " << double(end - start) / CLOCKS_PER_SEC << "s" << endl;  //输出时间(单位:s)
	t2 = GetTickCount();
	cout << "time = " << ((t2 - t1) * 1.0 / 1000) << "s" << endl;  //输出时间(单位:s)
	t =  double(end - start) / CLOCKS_PER_SEC;//((t2 - t1) * 1.0 / 1000);//
	return t;
}

void funcSquare()
{
	int square,i,odd,n;
	n = 100;
	odd = 3;
	i =1;
	for (square = 1; i <= n; odd += 2) {
		
		printf("%10d%10d\n", i , square);			

		++i;
		square += odd;
	}
}
/**
 * 平方.
 * 
 */
void func()
{
	int i, n;
	n = 100;
	for (i = 1; i <= n; i++)
		printf("%10d%10d\n", i, i * i);
}

/**
 * 是否是质数(素数).
 * 
 * \param num 判断的整数
 * \return 真假
 */
bool isPrime(int num)
{
	int d, i;
	bool isok = false;

	if (num == 1)
	{
		isok= false;
	}

	for(d = 2; d < num; d++) //循环,用d当作计算器,进行取模,计算是否可以相除,确定是否属于质素
	{
		if ( num%d==0) //可以相除,则退出
		{
			break; //退出 循环
		}
	}
	if (d < num) //如果比要检测的数要小,说明可以整除
	{
		printf("\n%d可以被%d整除,不是质数", num, d);
		isok = false;
	}
	else 
	{
		printf("\n%d是质数", num);
		isok = true;

	}

	return isok;
}



int main()
{
   std::cout << "Hello World!涂聚文\n";

   /**
    * 调用.
    * 
    * \return 
    */
   int num, num2, num3, num4;
   num = 6;
   num2 = 7;
   num3 = 8;
   num4 = 9;
   bool isf = isPrime(num);
   bool isf2 = isPrime(num2);
   bool isf3 = isPrime(num3);
   bool isf4 = isPrime(num4);
   string s1 = isf == true ? "true" :"false";
   string s2 = isf2 == true ? "true" : "false";
   string s3 = isf3 == true ? "true" : "false";
   string s4 = isf4 == true ? "true" : "false";
   printf("\n%d是质数? %s", num,s1.c_str());
   printf("\n%d是质数? %s", num2,s2.c_str());
   printf("\n%d是质数? %s", num3,s3.c_str());
   printf("\n%d是质数? %s", num4,s4.c_str());

   cout << endl;
   cout << num<<"是质数?" << s1 << endl;
   cout << num2 <<"是质数?" << s2 << endl;
   cout << num3 << "是质数?" << s3<< endl;
   cout << num4 << "是质数?" << s4<< endl;


   double st = timeSquare();
   double st2 = timeFunc();
   cout<<"funcSquare函数耗时:"<<st << "s" <<endl;
   cout << "func函数耗时" << st2 << "s" << endl;


}

  

 

 

 

 

 

 

https://carey.jhu.edu/uploads/faculty/BLOOMS_WORKSHOP.pdf
https://academicaffairs.unl.edu/documents/4-Revised-Blooms-Taxonomy.pdf
https://ishare.mq.edu.au/prod/file/9505dcdc-e1c9-4807-a946-d7b1c34d8a23/1/Blooms-Taxonomy.pdf
https://www.mheducation.ca/blog/how-to-use-blooms-taxonomy-of-learning-in-your-classroom
https://www.uky.edu/~rsand1/china2018/texts/Blooms%20Original-Revised%20Taxonomy%20Pyramids.pdf
https://ctl.oregonstate.edu/sites/ctl.oregonstate.edu/files/a_taxonomy_for_learning_teaching_and_assessing.pdf
https://www.kent.ac.uk/brussels/handbook/taxonomy.pdf

 https://one.oecd.org/document/OCDE/GD(96)102/en/pdf THE KNOWLEDGE-BASED ECONOMY

posted @ 2023-10-02 11:20  ®Geovin Du Dream Park™  阅读(58)  评论(0)    收藏  举报