Assignment: problems 8, 15, 22, 26, 30, 31, 33, 38 (pages
530-532)
groups of 5 persons.
submit your assignment (on Monday, Nov 16); office 514
present one of the problems above (slides), 5 min/group.
Lab 06
(Summer-semester.2011)
on Using Arrays
1. Write a program to read 2 integers m and n. Create 2 array s which contain m and n
integers respectively. Create a new array which is the merge of 2 in
Lab 07
(Summer-semester.2011)
on Using Arrays and Sorting Algorithms
1. A class has n students (n input from the screen), the students take part in an exam,
the exam paper contains 5 question which th
Lab 08
(Summer-semester.2011)
on Using Characters and Strings
1. Write a program to read a string contains family name, middle name, and first
name, then print out in the order: first name, family nam
By Quan Le-Trung, Intl University
C /C+
P ROGRAMMING IN
U NIX
Why programming?
Our civilization runs on softwares
Most engineering activities involve softwares
Ships
Design
Construction
Managemen
Introduction
Introduction to Problem Solving
Programming
Programming in
C
Introduction to Problem Solving
Bina 1998 Liran & Ofir
S1.2.1
Problem
Problem Solving
How to get the computer solve a problem?
#include <stdio.h>
int main()
cfw_
int m,n,a[100],b[100],c[100],i;
printf("enter value m\n");
scanf("0",&m);
printf("enter value n\n");
scanf("0",&n);
for(i=0;i<n;i+)
cfw_
printf("enter the ar
#include <stdio.h>
#include <math.h>
int main ()
cfw_int i,n;
float result=0;
printf("enter n: ");
scanf("0", &n);
for(i=1;i<=n;i=i+1);
cfw_result=sqrt(2+result);
printf("the result is 0\n",result);
r
Lab 01
(Summer-semester 2011)
on Basic C programming
1. Write a program to input an arbitrary number. If that number greater than or equal to 0,
calculate its square root, then print out the result. I
ASSIGNMENT of C/C+ Programming in UNIX
Summer-Semester.2011
Notes on Policy:
1. Compress all your directories/files (c files, executable files, & README.txt) into one
file with following format:
ccplu
Ti liu tham kho
The C Programming Language (2nd Edition) Kernighan & Ritchie
Prentice Hall 1988.
Ngn Ng Lp Trnh C. Quch Tun Ngc. Nh Xut Bn Gio Dc,
1998.
Efficient C programming. Mark Allen Weiss. Pren
Homework: 6, 7, 11, 16, 23, 29, 40, 48, 50
r
2
i
j
6. An electronsrposition is given by r = 3.00t - 4.00t + 2.00 k with t
in seconds and r in meters. (a) In unit-vector r
notation, what is the
r
elect
Homework: 1, 3, 4, 6 (page 500)
1. (page 500) Two constant-volume gas thermometers are assembled,
one with nitrogen and the other with hydrogen. Both contain enough
gas so that p3=80 kPa. (a) What is
Applying Newtons laws:
Sample Problem 5-8: In the figure below, a passenger of mass
m=72.2 kg stands on a platform scale in an elevator cab. We are
concerned with the scale readings when the cab is st
Homework: 10, 12, 19, 21 (page 500)
24, 32, 33, 38 (pages 501-502)
10. An aluminum flagpole is 33m high. By how much does its length
increase as the temperature increases by 15 C0?
For a linear expans
Homework: 7, 10, 15, 21, 25, 30, 33 (p 131-133)
r
7. A 3.5 kg block is pushed along a horizontal floor by a force F of
magnitude 15 N at an angle q=400 with the horizontal force. The
coefficient of ki
Homework: 46, 47, 48 (pages 502, 503)
46. A sample of gas is taken through cycle abca shown in the p-V
diagram (see figure). The net work done is +1.2 J. Along path ab,
the change in the internal ener
Homework: 41, 47, 52 (p. 134-135)
41. In the figure below, a car is driven at constant speed over a
circular hill and then into a circular valley with the same radius. At
the top of the hill, the norm
Chapter 3 The Kinetic Theory of Gases
3.1. Ideal Gases
3.1.1. Experimental Laws and the Equation of State
3.1.2. Molecular Model of an Ideal Gas
3.3. Mean Free Path
3.4. The Boltzmann Distribution Law
3.4.2. Conservative Forces and Potential Energy
The work done by a force F=F(x):
xf
xi
W=
F ( x)dx
xf
DU = -W = - xi F ( x)dx
a. Gravitational Potential Energy
DU = -W =
At a certain height y:
yf
- yi
Homework: 11, 12, 18, 20, 24 (p. 531)
11. In the temperature range 310 K to 330 K, the pressure p of a
certain nonideal gas is related to volume V and temperature T by:
T
T2
p = (24.9 J / K ) - (0.006
Homework: 1, 4, 14, 15, 18, 20, 26, 33, 37, 41
(pages 229-233)
4. What are (a) the x coordinate and (b) the y coordinate of the
center of mass for the uniform plate shown in the figure below if
L=5.0
#include <stdio.h>
#include <string.h>
int main ()
cfw_
char str1[]="to be or not to be";
char str2[6];
strncpy(str2,str1,5);
str2[5]='\0';
puts(str2);
return 0;