1. Homepage
  2. Programming
  3. ECE 3331 Programming Applications in Electical and Computer Engineering - Computer Problem 5: Assignment statement

ECE 3331 Programming Applications in Electical and Computer Engineering - Computer Problem 5: Assignment statement

Engage in a Conversation
USUniversity of HoustonECE 3331Programming Applications in Electical and Computer EngineeringCC++assignment statement

ECE 3331 Computer Problem 5 Spring 202 3 (due 11:59pm 5/22/ 2023) CourseNana.COM

An assignment statement consists of four parts: (a) The left hand side which must be a variable (b) The assignment operator, = (c) The right hand side which can be any legal expression (d) A semicolon, which terminates the statement. The most complicated part is the RHS, for C allows expressions of various sorts (e.g. function call s, variables, constants, expressions involving arithmetic operators). But, we will limit the RHS to the one of the following: (a) A constant (b) A variable (c) One function call, with only constants or variables as arguments (d) An expression with one binary arithmetic operator (+, -, *, /, %) in which the operands must be constants or variables. The following are examples of legal R HS of assignment operators under our rules : X = 12; x = y; x = fun( 12 ); X = y + z ; Y = x+12; CourseNana.COM

The following are examples of illegal RHS of assignment operators under our rules : X = fun1(fun2(x)); / illegal -nested function call / X = y + z + 10; / illegal – two operators / X = fun1(x) + z; / illegal operand / X = fun(a1, a2) / two operands / X = ‘c’; /illegal as RHS is not variable or constant, which can only be a number / X = fun(1c); / illegal variable name on RHS / We allow any amount of white space to separate parts of the assignment statement. You may assume that no assignment statement consists of more than 50 characters including white space (a tab, blank, and newline counts as a single character). CourseNana.COM

Write a program that reads in assignment statement s one at a time from a file cp5in.txt and then tests wheth er it is legal under our restr icted syntax bfore moving on to the next statement. If the assignment is legal, output “This statement is legal”, else if it is not illegal, output “T his statement is illegal” without stating what exactly is wrong with the statement, e.g. X = 12; You echo: X = 12; This statement is legal X = y + z + 10; You echo: X = y + z + 10; This statement is illegal CourseNana.COM

Note, while you do not have to use pointers for this assignment, it is highly recommended. Follow the C rules for identifiers, under which, for example, a variable’s name may not begin with a number. Also, you will have to check for variables on the LHS or the RHS of the expression and also as an argu ment to a function. The program echoes each statement (there will be multiple statements) as it is read and then prints out a message about its legality. The function main does only input, output. Use may read in the entire string at once. Check out function fgets(). The rest of the work must be done by other function(s). cp5in.txt is an example input file. cp5out.txt is the output corresponding to the input. Your output must be to the keyboard, however. Hint: The program needs to remember the previous character read so that the two can be compared. For example, the assignment statement’s LHS may not consist of a letter, a white space, and another letter. cp5 p2of2 CourseNana.COM

You will not be given points for documenti ng your code, but points will be docked if you do not, with a maximum penalty of -20 points. Again, you must document what each function does and what the different parameters are for, and critical sections of the code, including how you convert decimal to binary for both decimal integers and floating point numbers. CourseNana.COM


You may develop your program in Visual Studio or any other IDE of your choice but you must use standard C. Some of the more common errors when you move from a C++ system to standard C are: (1) using C++ style comments (//this is not standard C89 ) (2) placing variable declarations AFTER executable s tatements (works in C++ but not standard C 89) (3) using .C or .cpp as the file extension for the source file rather than .c Remember that your grade will depend not only on getting the right answers but also on program documentation (comments). Be sure you include the specified initial comments, describe each variable, and in the body describe each logical block. Your entire source program must be in a single file, of type .c, which you must begin with your cougarnet username followed by the letters cp5 (no spaces, all lowercase). Turn it in to Engineering Blackboard e.g. my cougarnet name is brsheth and so the file I will turn in is: brshethcp5 .c CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
US代写,University of Houston代写,ECE 3331代写,Programming Applications in Electical and Computer Engineering代写,C代写,C++代写,assignment statement 代写,US代编,University of Houston代编,ECE 3331代编,Programming Applications in Electical and Computer Engineering代编,C代编,C++代编,assignment statement 代编,US代考,University of Houston代考,ECE 3331代考,Programming Applications in Electical and Computer Engineering代考,C代考,C++代考,assignment statement 代考,UShelp,University of Houstonhelp,ECE 3331help,Programming Applications in Electical and Computer Engineeringhelp,Chelp,C++help,assignment statement help,US作业代写,University of Houston作业代写,ECE 3331作业代写,Programming Applications in Electical and Computer Engineering作业代写,C作业代写,C++作业代写,assignment statement 作业代写,US编程代写,University of Houston编程代写,ECE 3331编程代写,Programming Applications in Electical and Computer Engineering编程代写,C编程代写,C++编程代写,assignment statement 编程代写,USprogramming help,University of Houstonprogramming help,ECE 3331programming help,Programming Applications in Electical and Computer Engineeringprogramming help,Cprogramming help,C++programming help,assignment statement programming help,USassignment help,University of Houstonassignment help,ECE 3331assignment help,Programming Applications in Electical and Computer Engineeringassignment help,Cassignment help,C++assignment help,assignment statement assignment help,USsolution,University of Houstonsolution,ECE 3331solution,Programming Applications in Electical and Computer Engineeringsolution,Csolution,C++solution,assignment statement solution,