0

I Need Help With This Program The Obejct Is Well Write A Sentence In An Input File And Have The Program Ouput It To The Output Text Or .txt And I Have The Code Written And Everything But Im Getting Some Stupid Errors And Its Written On Console Application I Would Appreciate It For Ne One To Help

Attachments
program HW6;

{ Course: CSI 1000 Sp07
{ Assignment: Write a Pascal program in Delphi that will count the number of
{vowels (A,E,I,O,U), consonants (letters that are not vowels, including Y), and
{spaces in a file as it echos the input file back to the output file.
{ Due Date:  Due noon Friday April 13.
{ Programmer: Jeff Rasmussen
{ Purpose: The purpose of this program is to see if i can have a .txt file with
{ an input file and output file and have those files after the program is ran
{ tell you the amount of consonants and vowels plus the number of spaces in the
{ .txt file.
{ Input: for this program to do its ob it needs an input file and an output file
{ containing information for the program to be able to run.
{ Output: When the prgram is ran and all said and done it will output the
{ sentence with the counting so you know.


{$APPTYPE CONSOLE}

uses
  SysUtils;

 // setting up my variables for the program
var
writtenin : text;
writtenout : text;
skip : char;
vc, cc, sc, : integer;
// begin of main program and assigning the input and output for the program
begin
 assign( writtenin,'input.txt');
 assign( writtenout,'output.txt');

 reset(writtenin);
rewrite(writtenout);
 // initializing the variables
vc:= 0;
cc:= 0;
sc:= 0;
// beggining of loop
 while not eof(writtenin) do

   begin
      read(writtenin, skip); // reads in the sentence from the input file
      write(writtenout, skip);// then it echoes it to the output file
   if skip= ' ' then
    sc:= sc +1;
   'A', 'a':vc:=vc + 1;// the count proccess of the program to count the letters
   'E', 'e':vc:=vc + 1;
   'I', 'i':vc:=vc + 1;
   'O', 'o':vc:=vc + 1;
   'U', 'u':vc:=vc + 1;
   'B', 'b':cc:=cc +1;
   'C', 'c':cc:=cc +1;
   'D', 'd':cc:=cc +1;
   'F', 'f':cc:=cc +1;
   'G', 'g':cc:=cc +1;
   'H', 'h':cc:=cc +1;
   'J', 'j':cc:=cc +1;
   'K', 'k':cc:=cc +1;
   'L', 'l':cc:=cc +1;
   'M', 'm':cc:=cc +1;
   'N', 'n':cc:=cc +1;
   'P', 'p':cc:=cc +1;
   'Q', 'q':cc:=cc +1;
   'R', 'r':cc:=cc +1;
   'S', 's':cc:=cc +1;
   'T', 't':cc:=cc +1;
   'V', 'v':cc:=cc +1;
   'W', 'w':cc:=cc +1;
   'X', 'x':cc:=cc +1;
   'Y', 'y':cc:=cc +1;
   'Z', 'z':cc:=cc +1;
  end;// end of loop


writeln;
writeln;
writeln;
writeln;
writeln;



  // this depicts what you will see in the output file showing you and telling you
 writeln(writtenout);
  write(writtenout,' Your Sentence That You Chose To Write Contains FYI',vc,'vowels');
  write(writtenout,' Your Sentence That You Chose To Write Contains FYI',cc,'constants');
  write(writtenout,' Your Sentence That You Chose To Write Contains FYI',sc,'spaces');

 // these close the files after count is done
close(writtenin);
close(writtenout);

 readln;


end. //end of program
2
Contributors
5
Replies
6
Views
10 Years
Discussion Span
Last Post by chickenmcnugget
0

I Mean Have The Ouput File Also Say The Number Of Vowels And Constanants And Spaces In The File Sorry Forgot That Ne Oen Plz

0

1) you say that you have some errors, but you didn't look at the error, otherwise i think you figure out that you have an ','(comma) there....
2)Do Not Write In This Way Anymore....
3) your code is a total mess...try to use crowds and the "in" reserved word. you'll find more about that in help.

best regards,

0

thanx i used my book but im all good on it now i finished it and got a hundo and the apptite console we have to use the teacher says so....... but ne ways thanx for your help guys and ill prolly post more when needed and thats also how i write wuick and easy to understand later

0

if your code is fully functional, comment and post it here, in this way other newbies can learn

best regards,

0

ok will do for those who might need this later on for whatever reason and that i also like to help people out so here my program enjoy and


Best Regards

Attachments
program HW6;

{ Course: CSI 1000 Sp07
{ Assignment: Write a Pascal program in Delphi that will count the number of
{vowels (A,E,I,O,U), consonants (letters that are not vowels, including Y), and
{spaces in a file as it echos the input file back to the output file.
{ Due Date:  Due noon Friday April 13.
{ Programmer: Jeff Rasmussen
{ Purpose: The purpose of this program is to see if i can have a .txt file with
{ an input file and output file and have those files after the program is ran
{ tell you the amount of consonants and vowels plus the number of spaces in the
{ .txt file.
{ Input: for this program to do its ob it needs an input file and an output file
{ containing information for the program to be able to run.
{ Output: When the prgram is ran and all said and done it will output the
{ sentence with the counting so you know.


{$APPTYPE CONSOLE}

uses
  SysUtils;

 // setting up my variables for the program
var
writtenin : text;
writtenout : text;
skip : char;
vc, cc, sc : integer;
// begin of main program and assigning the input and output for the program
begin
 assign( writtenin,'input.txt');
 assign( writtenout,'output.txt');

 reset(writtenin);
rewrite(writtenout);
 // initializing the variables
vc:= 0;
cc:= 0;
sc:= 0;

// beggining of loop
 while not eof(writtenin) do

   begin
      read(writtenin, skip); // reads in the sentence from the input file
      write(writtenout, skip);// then it echoes it to the output file

  if  skip= ' ' then
  sc:= sc +1;
  case skip of

   'A', 'a':vc:=vc + 1;// the count proccess of the program to count the letters
   'E', 'e':vc:=vc + 1;
   'I', 'i':vc:=vc + 1;
   'O', 'o':vc:=vc + 1;
   'U', 'u':vc:=vc + 1;
   'B', 'b':cc:=cc +1;
   'C', 'c':cc:=cc +1;
   'D', 'd':cc:=cc +1;
   'F', 'f':cc:=cc +1;
   'G', 'g':cc:=cc +1;
   'H', 'h':cc:=cc +1;
   'J', 'j':cc:=cc +1;
   'K', 'k':cc:=cc +1;
   'L', 'l':cc:=cc +1;
   'M', 'm':cc:=cc +1;
   'N', 'n':cc:=cc +1;
   'P', 'p':cc:=cc +1;
   'Q', 'q':cc:=cc +1;
   'R', 'r':cc:=cc +1;
   'S', 's':cc:=cc +1;
   'T', 't':cc:=cc +1;
   'V', 'v':cc:=cc +1;
   'W', 'w':cc:=cc +1;
   'X', 'x':cc:=cc +1;
   'Y', 'y':cc:=cc +1;
   'Z', 'z':cc:=cc +1;
  end;
 end; // end of loop





  // this depicts what you will see in the output file showing you and telling you
 writeln(writtenout);
  write(writtenout,' Your Sentence That You Chose To Write Contains FYI ',vc,' vowels');
   writeln(writtenout);
   write(writtenout,' Your Sentence That You Chose To Write Contains FYI ',cc,' constants');
    writeln(writtenout);
  write(writtenout,' Your Sentence That You Chose To Write Contains FYI ',sc,' spaces');

 // these close the files after count is done
close(writtenin);
close(writtenout);

 readln


end. //end of program
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.