الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

Struct code

بدأه princesa في 19 مارس 2010 · 0 رد · 1,325 مشاهدة · في C++.Net
مشاركة: واتساب X فيسبوك تيليجرام
#1

السؤال شوي وجع لي راسي ولازم احله لأني احسه شوي في شغلات كثيرة

Write a program that counts the frequency of each letter in the alphabet (lower and upper case) in a text file named “IT.TXT”.

Define a structure that stores a letter and its frequency.

Your program should use an array of structures corresponding to the letters found in the file.

The program should then print a report showing each letter and its frequency.

وهذا الكود

# include <iostream>
# include <fstream>
# include<cctype>
using namespace std;
struct alphabet{
	int  frequency;
	char letter;
};
void main()
{
	ifstream fin;


	fin.open("IT.txt");

	alphabet letter[26];

	for(int i=0;i<26;i++)
	{
		if(letter >= 'a' && letter <= 'z')

			tolower++;
		if(letter >= 'A' && letter <= 'Z')
			toupper++;

	}

}

الي مو فاهمته كيف انه راح يحسب الأحرف

IT.txt

تم تعديل هذه المشاركة بواسطة princesa في 19 مارس 2010 في 16:50

مواضيع مشابهة