How to resolve the algorithm Determine sentence type step by step in the Epoxy programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Determine sentence type step by step in the Epoxy programming language

Table of Contents

Problem Statement

Use these sentences: "hi there, how are you today? I'd like to present to you the washing machine 9001. You have been nominated to win one of these! Just make sure you don't break it."

Don't leave any errors!

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Determine sentence type step by step in the Epoxy programming language

Source code in the epoxy programming language

const SentenceTypes: {
	["?"]:"Q",
	["."]:"S",
	["!"]:"E"
}

fn DetermineSentenceType(Char)
	return SentenceTypes[Char]||"N"
cls

fn GetSentences(Text)
	var Sentences: [],
		Index: 0,
		Length: #Text
	loop i:0;i
		var Char: string.subs(Text,i,1)
		var Type: DetermineSentenceType(Char)
		if Type != "N" || i==Length-1 then
			log(string.sub(Text,Index,i+1)+" ("+Type+")")
			Index:i+2;
		cls
	cls
cls

GetSentences("hi there, how are you today? I'd like to present to you the washing machine 9001. You have been nominated to win one of these! Just make sure you don't break it")

  

You may also check:How to resolve the algorithm Sorting algorithms/Sleep sort step by step in the NetRexx programming language
You may also check:How to resolve the algorithm Literals/Integer step by step in the Comal programming language
You may also check:How to resolve the algorithm XML/Input step by step in the ARM Assembly programming language
You may also check:How to resolve the algorithm Comments step by step in the Oberon-2 programming language
You may also check:How to resolve the algorithm Ray-casting algorithm step by step in the Julia programming language