Actual source code: ex15.c

petsc-3.6.4 2016-04-12
Report Typos and Errors
  2: static char help[] = "Demonstrates PetscPopUpSelect()\n";

  4: #include <petscsys.h>


  9: int main(int argc,char **argv)
 10: {
 11:   int        ierr,choice;
 12:   const char *choices[] = {"Say hello","Say goodbye"};

 14:   PetscInitialize(&argc,&argv,(char*)0,help);
 15:   PetscPopUpSelect(PETSC_COMM_WORLD,NULL,"Select one of ",2,choices,&choice);
 16:   PetscSynchronizedPrintf(PETSC_COMM_WORLD,"You selected %s\n",choices[choice]);
 17:   PetscSynchronizedFlush(PETSC_COMM_WORLD,PETSC_STDOUT);
 18:   PetscFinalize();
 19:   return 0;
 20: }