Lab Assignments


     Lecture Notes and Docs     Lab Assignments     Solved Problems     Course Progress     Calendar     Exams     Recent News     

You can use the following email to send your labs.

Here is the course email: uoz_cs_prog1@yahoo.com


Examples For Learning C++

posted Jun 3, 2013, 11:55 AM by Salah Ibrahim   [ updated Jun 3, 2013, 11:57 AM by Karwan Jacksi ]

Some PDF files for learning c++

Solution Of Class B

posted May 13, 2013, 12:57 PM by Salah Ibrahim   [ updated May 13, 2013, 12:57 PM by Karwan Jacksi ]

#include <iostream>
#include <fstream>
using namespace std;

double power(int x,int y)
{
int p = 1;
for (int i = 0; i < x; i++)
p *= y;
return p;
}

void main()
{
int i;
cout<<"Enter '1' for odd."<<endl;
cout<<"Enter '2' for even."<<endl;
cin>>i;

cout<<"Enter n : ";
int n;
cin>>n;

double sum = 0;

for (i; i <= n; i+=2)
sum += (1/power(i, i));

cout << "Result = " << sum << endl;
ofstream oFile;
oFile.open("result.txt");
oFile << "Result = " << sum << endl; 
oFile.close();

system ("pause");
}

Soultion Of Class A

posted May 13, 2013, 12:56 PM by Salah Ibrahim   [ updated May 13, 2013, 12:56 PM by Karwan Jacksi ]

#include <iostream>
#include <fstream>
using namespace std;

double average(double sum,int count)
{
return sum/count;
}

void main()
{
int num;
double sum = 0;
int count = 0;
ofstream ofile;
ofile.open("result.txt");
for(i=0; i<20; i++)
{
cout<<"Enter number ("<<i<<") : ";
cin>>num;
if(num >= 0)         
                {
 count += 1;      
 sum += num;    
        }
}
cout<<"Sum : "<<sum<<endl;
ofile<<"Sum : "<<sum<<endl;
cout<<"Average : "<<average(sum, count)<<endl;
ofile<<"Average : "<<average(sum, count)<<endl;
ofile.close();
system("pause");
}

Question:

posted May 13, 2013, 12:12 AM by Media Zaxo   [ updated May 13, 2013, 12:12 AM by Karwan Jacksi ]

Q1: write a program in c++ using  pointer with array to read a[5] and  “print” ,”inverted “ ,”summation” ,”average” arrays?

Q2: write program to reads matrix of D[3][3] then use three functions , reset -> to reset main diagonal & secondry diagonal to zeros , [print -> to print array element values]?  

Q3: {1,2,3,4,5,6}  ->  {1,3,6,10,15,21} use pointer?

Home Work (29-04-2013)

posted Apr 29, 2013, 2:27 AM by Salah Ibrahim   [ updated Apr 29, 2013, 2:27 AM by Karwan Jacksi ]

HW1: write a program in c++ that reads a matrix then find max and min values.

HW2: write a program in c++ that accepts matrix then swap main diagonal with secondary diagonal.

HW3: write a program in c++ that reads a matrix then count numbers that can be divide on 5.

Untitled Post

posted Apr 15, 2013, 2:53 AM by Media Zaxo   [ updated Apr 15, 2013, 2:53 AM by Karwan Jacksi ]

Question: 22/4/2013 
1- Write a program to read array size 10 and find maximum  numbers in the element array ?

2- Write a program to read array size 10 and find minimum  numbers in the element array ?

3- Write a program to read array and sort element array ascending ,size of 8?

4- Write a program to read array size 10 and find inverse array :

13

27

33

56

23

57

33

37

76

65

 The result:

65

76

37

33

57

23

56

33

27

13

Attension

posted Apr 14, 2013, 1:47 AM by Salah Ibrahim   [ updated Apr 14, 2013, 1:47 AM by Karwan Jacksi ]

Your homework of (03-04-2013) will be available until (18-04-2013).

Your teacher
Majd Salah

Untitled Post

posted Apr 10, 2013, 1:58 AM by Media Zaxo   [ updated Apr 15, 2013, 1:44 AM by Karwan Jacksi ]

question:15/4/2013
1- read array  size 10 and multiply all element of them ?

2- Write a program to enter 8 number then find square for all  numbers in the element array ?

3- Write a program to read two array ,add element of them  and put the result in three array size of 5?

 

Home Work (03-04-2013)

posted Apr 3, 2013, 1:48 AM by Salah Ibrahim   [ updated Apr 3, 2013, 1:48 AM by Karwan Jacksi ]

HW. Write a c++ function that accepts a number and the function must check if this number is :
            - positive and odd  or
            - positive and even  or
            - negative and odd  or
            - negative and even 
        and the function must return a string that explains that.

For Example:
      Enter a  number : -5
      Output : negative and odd.

Untitled Post

posted Apr 1, 2013, 2:38 AM by Media Zaxo   [ updated Apr 1, 2013, 3:41 AM by Karwan Jacksi ]

Homework1: GroupB 
 

1-10 of 30