Question: Could someone please help me understand the problem and fix it. I have provided my code and a explanation of what it does underneath. Thank
Could someone please help me understand the problem and fix it. I have provided my code and a explanation of what it does underneath. Thank you.
program Vowel_Checker
implicit none
!finding number of vowels in a sentence. !Declare Variables ! Integer variables are the vowels, spaces, and other letter. integer:: vowels, spaces, other_letter, letter_location ! Number of vowels, spaces, and other letter should beggin at 0. vowels= 0 spaces= 0 other_letter = 0 ! Character variables are the letter and the line Character(999) :: line character(1) :: letter
!Prompt for and read the line to determine the vowels in the sentence. read (*,'(a)') line
!loop from 1 to 999 for the letter location. do letter_location =1,999
!extracts one character at position of letter location. letter = line(letter_location)
!Create a selector for each letter in the line. select case (letter) !First selector should be able to identify vowels. case ('A' ,'E','I','O','U','a','e','i','o','u') vowels=vowels + 1 !Second selector should be able to identify spaces. case(' ') spaces=spaces+1 !Case default should be able to identify all other letters. case default other_letter=other_letter+1 !End the selector for finding vowels. end select
!End the loop for the letter location. end do
!Display the number of vowels found in the sentence. write (*,*) "Vowels:", vowels
end program Vowel_Checker

C:\Users\Jesus\Documents\spring 2017 CS117 gfortran -o c check 1.195 check 1.f95:21.22: Character (999) line Error: Unexpected data declaration statement at (1) check 1.f95:22.22: character (1) letter Error: Unexpected data declaration statement at (1) check 1.f95:31.1: letter line (letter location Error: Unclassifiable statement at (1) check 1.f95:34.20: select case (letter) Error: Symbol letter' at (1) has no IMPLICIT type check 1.f95 25.19: read (a) line Error: Symbol 'line at (1) has no IMPLICIT type check 1.f95:34.14: select case (letter) Error: Argument of SELECT statement at (1) cannot be UNKNOWN C:\Users\Jesus\Documents\spring 2017 CS117 gfortran -o c check 1.195 check 1.f95:21.22: Character (999) line Error: Unexpected data declaration statement at (1) check 1.f95:22.22: character (1) letter Error: Unexpected data declaration statement at (1) check 1.f95:31.1: letter line (letter location Error: Unclassifiable statement at (1) check 1.f95:34.20: select case (letter) Error: Symbol letter' at (1) has no IMPLICIT type check 1.f95 25.19: read (a) line Error: Symbol 'line at (1) has no IMPLICIT type check 1.f95:34.14: select case (letter) Error: Argument of SELECT statement at (1) cannot be UNKNOWN
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
