Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Grab this file to be analyzed by the program: ssb.txt. The Star-Spangled Banner

ID: 3642929 • Letter: G

Question


Grab this file to be analyzed by the program: ssb.txt.

The Star-Spangled Banner

O say, can you see, by the dawn's early light,
What so proudly we hail'd at the twilight's last gleaming?
Whose broad stripes and bright stars, thro' the perilous fight,
O'er the ramparts we watch'd, were so gallantly streaming?
And the rockets' red glare, the bombs bursting in air,
Gave proof thro' the night that our flag was still there.
O say, does that star-spangled banner yet wave
O'er the land of the free and the home of the brave?

On the shore dimly seen thro' the mists of the deep,
Where the foe's haughty host in dread silence reposes,
What is that which the breeze, o'er the towering steep,
As it fitfully blows, half conceals, half discloses?
Now it catches the gleam of the morning's first beam,
In full glory reflected, now shines on the stream:
'Tis the star-spangled banner: O, long may it wave
O'er the land of the free and the home of the brave!

And where is that band who so vauntingly swore
That the havoc of war and the battle's confusion,
A home and a country should leave us no more?
Their blood has wash'd out their foul footsteps' pollution.
No refuge could save the hireling and slave
From the terror of flight or the gloom of the grave:
And the star-spangled banner in triumph doth wave
O'er the land of the free and the home of the brave.

O thus be it ever when free-men shall stand
Between their lov'd home and the war's desolation;
Blest with vict'ry and peace, may the heav'n-rescued land
Praise the Pow'r that hath made and preserv'd us a nation!
Then conquer we must, when our cause it is just,
And this be our motto: "In God is our trust!"
And the star-spangled banner in triumph shall wave
O'er the land of the free and the home of the brave!

--Francis Scott Key, 1814

Basic Requirements
The basic requirements for the letter count program are as follows:

Explanation / Answer

please rate

#include <iostream>

#include <fstream>

using namespace std;  

int main( )

{  

int arr[26];

for(int i=0;i<26;i++)

{

arr[i] = 0;

}

ifstream infile( "ssb.txt" );  

if (!infile)  

{  

cerr << "Can't open file for reading!" << endl;  

return 1;

}

else

{  

for (int ch=infile.get(); !infile.eof(); ch=infile.get())  

{  

if((ch>='a' && ch<='z'))

{

arr[ch-'a']+=1;

}

if((ch>='A' && ch<='Z'))

{

arr[ch-'A']+=1;

}

}

for(int i=0;i<26;i++)

cout<<"#"<<(char)(i+65)<<"'s "<<arr[i]<<endl;   

infile.close();  

cout << endl;

}  

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote