مشكل در رابطه با win api

در اين بخش سوالات خودتون رو مطرح كنيد
موضوع جدید ارسال پست
yashar_gorbe
کاربر جدید
کاربر جدید
پست: 2
تاریخ عضویت: دوشنبه 2 تیر 1382, 12:00 am

مشكل در رابطه با win api

پست توسط yashar_gorbe »

دوستان عزيز سلام .
من پروژه اي دارم كه در رابزه با API ها ميباشد .
به يك مشكل خوردم و هر چي تلاش كردم موفق به حل آن نشدم .
من سوال و برنامه خودم رو مي زارم از دوستاني كه بتونن كمكم كنند صميمانه ممنونم و اميدوارم كه بتونم جبران كنم.

کد: انتخاب همه


#include<stdio.h>
#include<math.h>
#include <iostream>
#include <stdlib.h>
#include <windows.h>

	 DWORD i,j;
struct Param {
    int x;
    int y;
};

Param* p;
  
	
    int A[3][4]={{2,1,3,5},{6,4,3,2},{7,3,2,1}};
	int B[4][2]={{8,7},{1,4},{2,5},{3,6}};
    int C[3][2];


 DWORD WINAPI product(DWORD s)
{
	int s1;
	//struct Param p1 = * (struct Param *) s;
	 for (int l=0;l<4;l++)
		{
		  s1=s1+((A[i][l])*(B[l][i]));
          C[i][i]=s1;
		}
};
		



 int main(int argc, char *argv[])
{
 

	DWORD ThreadId;
	HANDLE ThreadHandle;
 
     p=new Param;
 

	 
	 for (i=0;i<3;i++)
		for(j=0;j<2;j++)
	 {
		p->x=i;
		p->y=i;
		
	//Create Thread that calls summation function with parameter i 
	ThreadHandle = CreateThread(
		NULL, // default security attributes
		0, //default stack size
	    product, //thread function
		&i, //parameters to thread function
		0, //default creation flags
		&ThreadId);//returns the thread identifier
	//Check of thread is created
	if(ThreadHandle != NULL)
		{
			WaitForSingleObject(ThreadHandle, INFINITE);
			CloseHandle(ThreadHandle);
	}
	else
		printf("Error creating thread");
	
 	return 0;
	}
		

}


اين هم سوال
1 Assignment Objectives
You will familiarize yourself with the Win32 API and the MSDN doc-
umentation for Win32
You will gain experience in creating threads using the Win32 API
2 Assignment Description
In this second programming assignment, you will write a C (or C++) pro-
gram, called matrixProduct , that generates a matrix C which is the matrix
product of A and B, where A is a matrix with M rows and K columns and
matrix B contains K rows and N columns ([SGG05] page 149 for more details
{ handout will be provided in class as well).
For this assignment, you will can initialize the values of matrices A and
B using one of the following methods:
1. read the values of the matrices from le matrixValues.txt, where the
format of this le is shown on the next page.
Last Updated March 28, 2007
COMP{354 Operating Systems Programming Assignment 2 2
matrixName num-of-rows num-of-cols
value value ...
value value ...
matrixName num-of-rows num-of-cols
value value ...
value value ...
An instance of the le matrixValues.txt may contain the values for
matrix A (3 rows, 4 columns) and matrix B (4 rows, 1 column) as
shown below:
A 3 4
1 2 3 4
5 6 7 8
10 11 12 13
B 4 1
2
2
2
2
2. statically initialize the arrays
3. read values of the matrices from the standard input
3 Useful Hint
On the class web site, there is an example multithreaded C program showing
how to create a thread using the Win32 API. It is recommended that you
study the program and understand how it works. Get this program up and
running! Understanding what goes on in this sample program will help you
implement the required matrix program.
4 Program Implementation Details
This assignment must be implemented in C or C++ programming language
using Win32 system calls. Use the MSDN library documentation if you need
any details on system calls or any other library functions.
Last Updated March 28, 2007


موضوع جدید ارسال پست

بازگشت به “++Visual C”