Vous êtes sur la page 1sur 3

======================================

>>>>>>>>>>>FILE HEADER< <<<<<<<<<<<<<<<


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

//.h is not required


// file processing

======================================
>>>>>>>>>>> MAIN<<< <<<<<<<<<<<<<<<<<<
======================================
int main(){
return 0;
}
======================================
>>>>>>>>>>>TYPEDEF<<< <<<<<<<<<<<<<<<<
======================================
typedef <type> <newname>;
======================================
>>>>>>>>>>>STRUCTURE< <<<<<<<<<<<<<<<
======================================
struct Point {
double x,y;
void set(double,double);
}
Point p1,p2;
p1.x=32;
======================================
>>>>>>>>>>>CLASS< <<<<<<<<<<<<<<<<<<<<
======================================
class Time{
int hour;
public:
Time(){hour=12;}
void printTime(){cout<<hour;}
}
Time T;
T.printTime();
======================================
>>>>>>>>>>>FUNCTIONS<<<<<<<<<<< <<<<<<
======================================
/////////function prototype
void hellofunction(void);
/////////function definition
void hellofunction(void){
cout<<"Hello!"<<endl;
}
/////////call by reference using reference variable

void change(int &);


int main(){
int i=5;
change(i); //call by reference in c++
return 0;
}
void change(int &i){
i=6;
}
======================================
>>>>>>>>>>>DATA TYPES<<<<<<<<<<<<<<<<<
======================================
bool newbool=false;
string a="Yap Yen Yin";
a="Tan Han Hui";

//new data type in C++

======================================
>>>>>>>>>>>INPUT OUTPUT<<<<<<<<<<<<<<<
======================================
string a;
cout<<endl;
getline(cin,a);
cin.clear();
cin.ignore(numeric_limits<streamsize>::max(),'\n');
======================================
>>>>>>>>>>>DYNAMIC<<<<<<<<<<<<<<<
======================================
int* int_ptr=new int;
int* int_ptr_array=new int[50];
delete int_ptr;
delete[] int_ptr_array;
no need use memset to initialize the buffer to 0, because it is automatically se
t to 0.
======================================
>>>>>>>>>>>DELAY<<<<<<<<<<<<<<<<<<<<<<
======================================
::Sleep(100);
======================================
>>>>>>>>>>>USE PTHREADS LIB<<<<<<<<<<<
======================================
Copy the pthread folder into the project folder, where the source codes are stor
ed.
#include "PThread\\pthread.h"
Properties->C++->Additional Include Directories->"$(SolutionDir)"; "$(ProjectDir
)"
Linker->Input->Additional Dependencies->PThread\pthreadVC1.lib
Put the pthreadVC1.dll in the debug folder together with executable files.
======================================
>>>>>>>>>>>OMP<<<<<<<<<<<
======================================

#include <omp.h>
Project Properties->C/C++->Language->OpenMP Support->Yes
not available in visual studio express version
======================================
>>>>>>>>>>>MPI<<<<<<<<<<<
======================================
int _tmain(int argc, _TCHAR* argv[]){
MPI_Init(&argc,&argv);
MPI_Comm_rank(MPI_COMM_WORLD,&my_rank);
MPI_Comm_size(MPI_COMM_WORLD,&p);
}
*Same account name for all computers.
*The executable files must be in the same folder in all computers.
*Only the host PC can display data.
*Can run MPI from command prompt>go to the program folder>"mpiexec.exe" -np 4 MP
ILearn.exe
After broadcast, it requires barrier.
Set user account password.
Set account notification levels
Install MPI
set Tools->Option in Visual Basic
create project
set multibyte character
set mpi.lib and cxx.lib at linker input.
register mpi
go to the project folder at cmd
type "C:\Program Files (x86)\MPICH2\bin\mpiexec" -np 4 Tut8_Parallel_Home.exe
======================================
>>>>>>>>>>EVENT<<<<<<<<<<<
======================================
g_WaitEvent=CreateEvent(NULL,TRUE,FALSE,NULL);
WaitForSingleObject(g_WaitEvent, INFINITE);
SetEvent(g_WaitEvent);
ResetEvent(g_WaitEvent);
======================================
>>>>>>>>>>MISCELLANEOUS<<<<<<<<<<<
======================================
sprintf //printfunction into string

Vous aimerez peut-être aussi