SlideShare une entreprise Scribd logo
1  sur  2
ECE 222 System Programming Concepts
                                  Fall 2006

Lab 3 – String math

In this lab, each student is to write a program that allows the user to perform pseudo
arithmetic on a string. Upon starting, the program should tell the user that it is a string
math program, along with brief instructions on how to use the program. The program
should then enter a loop, where it gives a prompt, such as “input>”. Upon receiving input
from the user, the program should process it, report the output result (or error), and loop
back to the prompt. This should continue until the user gives the keyphrase to exit the
program (keyphrase is your choice, good choices are “quit”, “end”, “exit”, etc.).

Input from the user should be of the form SOS, where S represents a string and O
represents a mathematical symbol. There should be no spaces between the three parts (the
two S’s and the O). A string should consist of from 1 to 9 lower case letters. The
mathematical symbol should be from the set + - / *. These symbols correspond to their
natural use in the C language: addition, subtraction, division and multiplication.

If the user inputs a string containing symbols outside the lower case letters, or if the string
has more than 9 characters, the program should report an error. If the user inputs a
mathematical symbol outside the expected set, the program should report an error. If the
input provided by the user is not of the form SOS, for example if it is only SO, or only S,
then the program should report an error. The error messages can be generic, they do not
have to describe specifically what the user did wrong.

If a grammatically correct input is entered, the program should convert the two strings to
integer arrays and perform the given operation on each cell independently. The resulting
array should then be converted back to a string, and displayed to the user. For example:

Input> abc+aab
abc + aab => bce

The output must be exactly in that format, showing the two strings and mathematical
symbol separated by spaces, to demonstrate that the program has correctly subdivided the
input into its 3 parts.

The mathematical operations should work as follows. Each character should be converted
to an integer in the range 1-26 (a is 1, b is 2, c is 3, …, z is 26). The operation should then
be performed using integer math. If the result is inside the range 1-26, then the output
character should be the corresponding lower case letter. If the result is outside the range
1-26, then the output character should be a capitalized version of the input character from
the first string. For example:

Input> wxy+bbb
wxy + bbb => yzY
If the two input strings are not the same length, then each output character beyond the
length of the shorter string should be a copy of the character from the longer string. For
example:

Input> xyz+a
xyz + a => yyz

Finally, here are some additional examples to clarify all expected operations. These do not
necessarily encompass all checks for errors, or all the cases that will be tested.

                    input                                          output
abc-aa                                          Aac
dog*cat                                         loG
turtle/frog                                     caable
Frog+turtle                                     bad input
bird/tiger                                      BabDr
emu+zebra                                       Erwra

This lab should be done entirely without string functions! Any usage of strlen(), strcpy(),
strcmp(), or related functions will result in a penalty.

This lab is due by Thursday, September 14. You must submit your C-code (as an
attachment) to assign@assign.ece.clemson.edu. Use as subject header ECE222-1,#2 (or
ECE222-2,#2, depending on your course section). This email is due by midnight of the due
date. Work must be completed by each individual student. If it is determined that a piece
of work has been copied, all parties involved will receive zero credit, and a letter grade nay
be deducted at the end of the semester.

Contenu connexe

Tendances

datatypes and variables in c language
 datatypes and variables in c language datatypes and variables in c language
datatypes and variables in c languageRai University
 
MolinaLeydi_FinalProject
MolinaLeydi_FinalProjectMolinaLeydi_FinalProject
MolinaLeydi_FinalProjectLeydi Molina
 
Constants in C Programming
Constants in C ProgrammingConstants in C Programming
Constants in C Programmingprogramming9
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data typesPratik Devmurari
 
Decision statements in c language
Decision statements in c languageDecision statements in c language
Decision statements in c languagetanmaymodi4
 
Error correction-and-type-of-error-in-c
Error correction-and-type-of-error-in-cError correction-and-type-of-error-in-c
Error correction-and-type-of-error-in-cMd Nazmul Hossain Mir
 
Operator Precedence and Associativity
Operator Precedence and AssociativityOperator Precedence and Associativity
Operator Precedence and AssociativityNicole Ynne Estabillo
 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c languagetanmaymodi4
 
Cpu-fundamental of C
Cpu-fundamental of CCpu-fundamental of C
Cpu-fundamental of CSuchit Patel
 
Algorithms and flowcharts
Algorithms and flowchartsAlgorithms and flowcharts
Algorithms and flowchartsSamuel Igbanogu
 
C sharp_basic_ideas
C sharp_basic_ideasC sharp_basic_ideas
C sharp_basic_ideasRalph Weber
 
What is identifier c programming
What is identifier c programmingWhat is identifier c programming
What is identifier c programmingRumman Ansari
 
Storage classes in c language
Storage classes in c languageStorage classes in c language
Storage classes in c languagetanmaymodi4
 
04a intro while
04a intro while04a intro while
04a intro whilehasfaa1017
 

Tendances (20)

datatypes and variables in c language
 datatypes and variables in c language datatypes and variables in c language
datatypes and variables in c language
 
MolinaLeydi_FinalProject
MolinaLeydi_FinalProjectMolinaLeydi_FinalProject
MolinaLeydi_FinalProject
 
Constants in C Programming
Constants in C ProgrammingConstants in C Programming
Constants in C Programming
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data types
 
Decision statements in c language
Decision statements in c languageDecision statements in c language
Decision statements in c language
 
Error correction-and-type-of-error-in-c
Error correction-and-type-of-error-in-cError correction-and-type-of-error-in-c
Error correction-and-type-of-error-in-c
 
Operator Precedence and Associativity
Operator Precedence and AssociativityOperator Precedence and Associativity
Operator Precedence and Associativity
 
Operators and expressions in c language
Operators and expressions in c languageOperators and expressions in c language
Operators and expressions in c language
 
Experiment 9(exceptions)
Experiment 9(exceptions)Experiment 9(exceptions)
Experiment 9(exceptions)
 
Cpu-fundamental of C
Cpu-fundamental of CCpu-fundamental of C
Cpu-fundamental of C
 
Type conversion
Type conversionType conversion
Type conversion
 
Pseudocode By ZAK
Pseudocode By ZAKPseudocode By ZAK
Pseudocode By ZAK
 
algo
algoalgo
algo
 
Assignment7
Assignment7Assignment7
Assignment7
 
Algorithms and flowcharts
Algorithms and flowchartsAlgorithms and flowcharts
Algorithms and flowcharts
 
C sharp_basic_ideas
C sharp_basic_ideasC sharp_basic_ideas
C sharp_basic_ideas
 
CP Handout#10
CP Handout#10CP Handout#10
CP Handout#10
 
What is identifier c programming
What is identifier c programmingWhat is identifier c programming
What is identifier c programming
 
Storage classes in c language
Storage classes in c languageStorage classes in c language
Storage classes in c language
 
04a intro while
04a intro while04a intro while
04a intro while
 

Similaire à lab3

Create a Java non-GUI stand-alone application that displays a histog
Create a Java non-GUI stand-alone application that displays a histogCreate a Java non-GUI stand-alone application that displays a histog
Create a Java non-GUI stand-alone application that displays a histogkedsliemichal
 
C Programming Interview Questions
C Programming Interview QuestionsC Programming Interview Questions
C Programming Interview QuestionsGradeup
 
Java: Primitive Data Types
Java: Primitive Data TypesJava: Primitive Data Types
Java: Primitive Data TypesTareq Hasan
 
Linear Data Structures_SSD.pdf
Linear Data Structures_SSD.pdfLinear Data Structures_SSD.pdf
Linear Data Structures_SSD.pdfssuser37b0e0
 
The concept of stack is extremely important in computer science and .pdf
The concept of stack is extremely important in computer science and .pdfThe concept of stack is extremely important in computer science and .pdf
The concept of stack is extremely important in computer science and .pdfarihantsherwani
 
INPUT AND OUTPUT PROCESSINGPlease note that the material o.docx
INPUT AND OUTPUT PROCESSINGPlease note that the material o.docxINPUT AND OUTPUT PROCESSINGPlease note that the material o.docx
INPUT AND OUTPUT PROCESSINGPlease note that the material o.docxjaggernaoma
 
C++ Programming Homework Help
C++ Programming Homework HelpC++ Programming Homework Help
C++ Programming Homework HelpC++ Homework Help
 
Java programming lab assignments
Java programming lab assignments Java programming lab assignments
Java programming lab assignments rajni kaushal
 
Ecs 10 programming assignment 4 loopapalooza
Ecs 10 programming assignment 4   loopapaloozaEcs 10 programming assignment 4   loopapalooza
Ecs 10 programming assignment 4 loopapaloozaJenniferBall44
 
Best C++ Programming Homework Help
Best C++ Programming Homework HelpBest C++ Programming Homework Help
Best C++ Programming Homework HelpC++ Homework Help
 
[C++][a] tutorial 2
[C++][a] tutorial 2[C++][a] tutorial 2
[C++][a] tutorial 2yasir_cesc
 
Lewis jssap3 e_labman02
Lewis jssap3 e_labman02Lewis jssap3 e_labman02
Lewis jssap3 e_labman02auswhit
 
Maxima - minimalism in mathematics
Maxima - minimalism in mathematicsMaxima - minimalism in mathematics
Maxima - minimalism in mathematicsSergeiPronkevich
 
Consider this code using the ArrayBag of Section 5.2 and the Locat.docx
Consider this code using the ArrayBag of Section 5.2 and the Locat.docxConsider this code using the ArrayBag of Section 5.2 and the Locat.docx
Consider this code using the ArrayBag of Section 5.2 and the Locat.docxmaxinesmith73660
 
Objectives Assignment 09 Applications of Stacks COS.docx
Objectives Assignment 09 Applications of Stacks COS.docxObjectives Assignment 09 Applications of Stacks COS.docx
Objectives Assignment 09 Applications of Stacks COS.docxdunhamadell
 
This code i would want to work ssh compiling for the this ta.pdf
This code i would want to work ssh compiling for the this ta.pdfThis code i would want to work ssh compiling for the this ta.pdf
This code i would want to work ssh compiling for the this ta.pdfadmin447081
 
basics of C and c++ by eteaching
basics of C and c++ by eteachingbasics of C and c++ by eteaching
basics of C and c++ by eteachingeteaching
 

Similaire à lab3 (20)

Create a Java non-GUI stand-alone application that displays a histog
Create a Java non-GUI stand-alone application that displays a histogCreate a Java non-GUI stand-alone application that displays a histog
Create a Java non-GUI stand-alone application that displays a histog
 
Input-output
Input-outputInput-output
Input-output
 
A01
A01A01
A01
 
C Programming Interview Questions
C Programming Interview QuestionsC Programming Interview Questions
C Programming Interview Questions
 
Java: Primitive Data Types
Java: Primitive Data TypesJava: Primitive Data Types
Java: Primitive Data Types
 
Linear Data Structures_SSD.pdf
Linear Data Structures_SSD.pdfLinear Data Structures_SSD.pdf
Linear Data Structures_SSD.pdf
 
The concept of stack is extremely important in computer science and .pdf
The concept of stack is extremely important in computer science and .pdfThe concept of stack is extremely important in computer science and .pdf
The concept of stack is extremely important in computer science and .pdf
 
INPUT AND OUTPUT PROCESSINGPlease note that the material o.docx
INPUT AND OUTPUT PROCESSINGPlease note that the material o.docxINPUT AND OUTPUT PROCESSINGPlease note that the material o.docx
INPUT AND OUTPUT PROCESSINGPlease note that the material o.docx
 
C++ Programming Homework Help
C++ Programming Homework HelpC++ Programming Homework Help
C++ Programming Homework Help
 
Java programming lab assignments
Java programming lab assignments Java programming lab assignments
Java programming lab assignments
 
Ecs 10 programming assignment 4 loopapalooza
Ecs 10 programming assignment 4   loopapaloozaEcs 10 programming assignment 4   loopapalooza
Ecs 10 programming assignment 4 loopapalooza
 
Best C++ Programming Homework Help
Best C++ Programming Homework HelpBest C++ Programming Homework Help
Best C++ Programming Homework Help
 
[C++][a] tutorial 2
[C++][a] tutorial 2[C++][a] tutorial 2
[C++][a] tutorial 2
 
Lewis jssap3 e_labman02
Lewis jssap3 e_labman02Lewis jssap3 e_labman02
Lewis jssap3 e_labman02
 
Maxima - minimalism in mathematics
Maxima - minimalism in mathematicsMaxima - minimalism in mathematics
Maxima - minimalism in mathematics
 
Testing techniques
Testing techniquesTesting techniques
Testing techniques
 
Consider this code using the ArrayBag of Section 5.2 and the Locat.docx
Consider this code using the ArrayBag of Section 5.2 and the Locat.docxConsider this code using the ArrayBag of Section 5.2 and the Locat.docx
Consider this code using the ArrayBag of Section 5.2 and the Locat.docx
 
Objectives Assignment 09 Applications of Stacks COS.docx
Objectives Assignment 09 Applications of Stacks COS.docxObjectives Assignment 09 Applications of Stacks COS.docx
Objectives Assignment 09 Applications of Stacks COS.docx
 
This code i would want to work ssh compiling for the this ta.pdf
This code i would want to work ssh compiling for the this ta.pdfThis code i would want to work ssh compiling for the this ta.pdf
This code i would want to work ssh compiling for the this ta.pdf
 
basics of C and c++ by eteaching
basics of C and c++ by eteachingbasics of C and c++ by eteaching
basics of C and c++ by eteaching
 

Dernier

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 

Dernier (20)

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 

lab3

  • 1. ECE 222 System Programming Concepts Fall 2006 Lab 3 – String math In this lab, each student is to write a program that allows the user to perform pseudo arithmetic on a string. Upon starting, the program should tell the user that it is a string math program, along with brief instructions on how to use the program. The program should then enter a loop, where it gives a prompt, such as “input>”. Upon receiving input from the user, the program should process it, report the output result (or error), and loop back to the prompt. This should continue until the user gives the keyphrase to exit the program (keyphrase is your choice, good choices are “quit”, “end”, “exit”, etc.). Input from the user should be of the form SOS, where S represents a string and O represents a mathematical symbol. There should be no spaces between the three parts (the two S’s and the O). A string should consist of from 1 to 9 lower case letters. The mathematical symbol should be from the set + - / *. These symbols correspond to their natural use in the C language: addition, subtraction, division and multiplication. If the user inputs a string containing symbols outside the lower case letters, or if the string has more than 9 characters, the program should report an error. If the user inputs a mathematical symbol outside the expected set, the program should report an error. If the input provided by the user is not of the form SOS, for example if it is only SO, or only S, then the program should report an error. The error messages can be generic, they do not have to describe specifically what the user did wrong. If a grammatically correct input is entered, the program should convert the two strings to integer arrays and perform the given operation on each cell independently. The resulting array should then be converted back to a string, and displayed to the user. For example: Input> abc+aab abc + aab => bce The output must be exactly in that format, showing the two strings and mathematical symbol separated by spaces, to demonstrate that the program has correctly subdivided the input into its 3 parts. The mathematical operations should work as follows. Each character should be converted to an integer in the range 1-26 (a is 1, b is 2, c is 3, …, z is 26). The operation should then be performed using integer math. If the result is inside the range 1-26, then the output character should be the corresponding lower case letter. If the result is outside the range 1-26, then the output character should be a capitalized version of the input character from the first string. For example: Input> wxy+bbb wxy + bbb => yzY
  • 2. If the two input strings are not the same length, then each output character beyond the length of the shorter string should be a copy of the character from the longer string. For example: Input> xyz+a xyz + a => yyz Finally, here are some additional examples to clarify all expected operations. These do not necessarily encompass all checks for errors, or all the cases that will be tested. input output abc-aa Aac dog*cat loG turtle/frog caable Frog+turtle bad input bird/tiger BabDr emu+zebra Erwra This lab should be done entirely without string functions! Any usage of strlen(), strcpy(), strcmp(), or related functions will result in a penalty. This lab is due by Thursday, September 14. You must submit your C-code (as an attachment) to assign@assign.ece.clemson.edu. Use as subject header ECE222-1,#2 (or ECE222-2,#2, depending on your course section). This email is due by midnight of the due date. Work must be completed by each individual student. If it is determined that a piece of work has been copied, all parties involved will receive zero credit, and a letter grade nay be deducted at the end of the semester.