📅  最后修改于: 2022-03-11 15:00:05.848000             🧑  作者: Mango
#include
#include
using namespace std;
int main( int argc, char ** argv)
{
int rank, size;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
char message[255];
char nadawanie[255];
if(rank==0)
{
cin>>nadawanie;
MPI_Send(&nadawanie, 255, MPI_CHAR, 1, 0, MPI_COMM_WORLD);
}
else if(rank == 1)
{
MPI_Recv(&message, 255, MPI_CHAR, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD_ MPI_STATUS_IGNORE);
cout << message << endl;
}
}