ECE 3331, Dr. Hebert, Fall 2015 Homework 1, Due 9/1
Problem 1.
Section 1.1, Exercise 1.
Problem 2.
Section 1.1, Exercise 3.
Problem 3.
Section 1.3, Exercise 8.
Problem 4.
Section 1.3, Exercise 11.
Problem 5.
Section 1.3, Exercise 23.
Problem 6.
Section 2.
Non recursive function that computes factorials
int fact( int num)
cfw_
int val;
if(num<=1)
return 1;
val=num;
while(num>1)
val *=num;
return val;
Description
Operator
Assoc. from
Precedence
Function expr
()
^
High

Array expr
[]

(Eval first)
Struct
(1)Using with scanf or fscanf: skips leading white space to first nonwhite space, begins converting
stopping with next white space; adds null. Addition of field width sets maximum number of characters to
look at, will still stop sooner if encounters whit
real function urand(iy)
integer iy
c urand is a portable uniform random number generator based on
c suggestions given by D.E. Knuth and appearing in Computer Methods
c for Mathematical Computations by Forsythe, Malcom & Moler.
c The integer iy should b
ECE 3331 CP6 Spring 2007 SOLUTION FOR SAMPLE DATA
*
For data set
1:
The seed is
911
The squares are
5 by
5
and we are generating
4 of them
Latin Square Number
row
1:
row
2:
row
3:
row
4:
row
5:
1
5
2
4
3
1
2
4
3
1
5
1
5
2
4
3
3
1
5
2
4
4
3
1
5
2
1
5
3
2
4
CP6. 1
ECE 3331 COMPUTER PROBLEM 6 Spring 2007
(due 4/27)
Your assignment is simply to redo Computer Problem 3 in Fortran77. That is, in this assignment you are to
write a Fortran program that will read from a data file named cp60710.txt a sequence of tri
page 1
Searching & Sorting
Searching
If you need to find the location of a particular value in an array, you generally must compare each value
in the array with the "target" in a sequential fashion until it is found or the entire array has been examined.
Nonobject Extensions in C+
1. End of line comments (/)
In addition to the C comment delimiters of /* and */, C+ provides for starting a comment with /
The rest of the line will then be treated as a commentbut it is only good for a single line.
2. C vers
Conversion Code g for Output
The g (or G) conversion code may be used to perform signed, decimal floating point (float or double) conversion as an
alternative to the f or e. The basic idea with the g code is to output the value in either decimal or expone
GCC and Engineering Unix/Linux Cluster
GCC is an acronym for the GNU compiler collection. GCC is a collection of frontend, language specific
interfaces to a common, backend compilation engine. The list of compilers includes C, C+, Objective C,
Fortran,
Elementary Math Functions
The elementary math functions include functions to perform a number of common computations. To have access
to these functions, your source file must include the preprocessor directive:
#include <math.h>
Following is a list of the
Some Comments on Comments
1. Every source file in this class must begin with comments identifying the user, the assignment, the
purpose. The following template is "suggested"
/*
*
Name  your name
Email  your email
ECE 3331 Computer Problem 1
Semester Sp
MATRIX MULTIPLICATION WITH DYNAMIC ALLOCATION
#include <stdio.h>
#include <stdlib.h>
typedef double* Matrix; /* hide the double* data type */
void
store( char* file, Matrix m1, Matrix m2, int n ),
mult( Matrix m1, Matrix m2, Matrix m3, int n ),
print( Mat
Missed Exams
If you miss taking an exam, you will receive a zero on the exam unless you do the following:
1. Immediately  as soon as possible but no later than 48 hours after the scheduled exam notify
your instructor
2. As soon as possible, take to your
page1of
Signature:_
DO NOT OPEN THIS BOOKLET UNTIL YOU ARE INSTRUCTED TO DO SO
ELEE 3331 FINAL EXAM Fall 1997
I.Indicate the output that would be produced by each of the following. Consider each case separately.
A.(10pts)
#include <stdio.h>
#include <stri
C+
A.
History of C and C+
1.
C Programming language was developed from 19691973 at Bell labs, along with the
UNIX operating system.
2,
C was a direct descendant of the language B, which was a typeless language developed
by Ken Thompson as a systems progr
The FORMAT statement
We can obtain greater control over the conversion and formatting of
input/output items by replacing the asterisk in a READ or PRINT statement by the
label of a FORMAT statement, for example:
READ 10,A,B,C
FORMAT(.)
10
The FORMAT state
C Sequence Points
Between consecutive sequence points, an objects value can be modified only once by
an expression. The C language defines the following sequence points:
Left operand of the logicaland operator (&). The left operand of the logicaland
ope
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
*
Paul Dinh
ddinh5@uh.edu
ECE 3331 Program 6
Spring 2007
*
Purpose  This program will create a specified number of
latin squares and display them in matrix form. It will
then check if they are "magic" or not  that is, if th
MZ#@# !#L!
This program cannot be run in DOS mode.
$#PE#L#P9F#3#8#
#,# #@#
#X#
#.text#D#
#
#`.data#L# #@#.bss#,#
#.idata#X#@#.stab#<#
B.stabstr#B#
#
#
#
#
page 1 of
Signature:_
DO NOT OPEN THIS BOOKLET UNTIL YOU ARE INSTRUCTED TO DO SO
ELEE 3331 FINAL EXAM Fall 1997
I.Indicate the output that would be produced
A.(10pts)
#include <stdio.h>
#include <string.h>
main( )
cfw_char s[ ]="Algernon",t[20]="Timbuktu"
page 1 of 3
Fall 2002
Consider the following declarations:
double one[10]=cfw_1.0,2.1,3.5,4.8,5.3,6.7,7.2,8.1,9.3,10.4;
double two[5][5],*ptr, value=1.0;
1.(12pts, 2 each) )Indicate whether each of the following statements would be valid or invalid, and i
Chapter 1
1032 bits are interpreted as the
value
Twos Complement Form For signed integers,
the leftmost
bit is used for sign. 0 for positive and 1
for negative.
Ex: Convert the 2s complement integer
10101100 to
decimal.
Solution: Find the absolute value
/*
CP3  Digital Picture Edge Detection
*
Purpose: To process digital pictures and
manipulate and output a cleaned edge
picture.
*
Data Files: cp3.ininput file
cp3.outoutput file
*
#include <stdio.h>
#define RC 10
/*defines the maximum
rowcolumn size o
Chapter 1
Twos Complement Form For signed integers, the
leftmost
bit is used for sign. 0 for positive and 1 for
negative.
Ex: Convert the 2s complement integer
10101100 to
decimal.
Solution: Find the absolute value of the
integer by
changing each 1 to 0