• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ readInput函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中readInput函数的典型用法代码示例。如果您正苦于以下问题:C++ readInput函数的具体用法?C++ readInput怎么用?C++ readInput使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了readInput函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: QWidget

XyzWidget::XyzWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::XyzWidget)
{
        ui->setupUi(this);

        //rpy = readInput("/Users/utilisateur/Documents/Navia/GUI/XYZ/rpy.txt");
        //xyz = readInput("/Users/utilisateur/Documents/Navia/GUI/XYZ/log_out.txt");

        QString namerpy = QFileDialog::getOpenFileName(this, tr("Open RPY"),
        "",
        tr("Text files (*.txt)"));
        QString namexyz = QFileDialog::getOpenFileName(this, tr("Open LOGOUT"),
        "",
        tr("Text files (*.txt)"));

        rpy=readInput(namerpy);
        xyz=readInput(namexyz);

        //fenêtre XYZ
        setupRealtimeData1(ui->customPlot1);

        //fenêtre Vx Vy Vz
        setupRealtimeData2(ui->customPlot2);

        //febêtre ax ay az
        setupRealtimeData3(ui->customPlot3);

        //fenêtre R P Y
        setupRealtimeData4(ui->customPlot4);

        connect(&datatimer, SIGNAL(timeout()), this, SLOT(readResponseXYZ()));
        datatimer.start(0); // Interval 0 means to refresh as fast as possible

    }
开发者ID:NaviPolytechnique,项目名称:GUI,代码行数:35,代码来源:xyzwidget.cpp


示例2: evaluateExpressions

void evaluateExpressions() {
    int degree = 1;
    char *varName;
  char *ar;
  List tl, tl1; 
  double w;
  printf("give an expression: ");
  ar = readInput();
  while (ar[0] != '!') {
    tl = tokenList(ar); 
    printf("\nthe token list is ");
    printList(tl);
    tl1 = tl;
    if ( valueExpression(&tl1,&w) && tl1==NULL ) {
               /* there may be no tokens left */ 
      printf("this is a numerical expression with value %g\n",w); 
    } else {
      tl1 = tl;
      if ( acceptExpression(&tl1, varName, &degree) && tl1 == NULL ) {
        printf("this is an arithmetical expression\n"); 
      } else {
        printf("this is not an expression\n"); 
      }
    }
    free(ar);
    freeTokenList(tl);
    printf("\ngive an expression: ");
    ar = readInput();
  }
  free(ar);
  printf("good bye\n");
}
开发者ID:DanielsWrath,项目名称:ADNC,代码行数:32,代码来源:evalExp.c


示例3: process_file

int process_file(char *batch_file)
{
	FILE * batch_stream;
	char *cmdLine;
	READ_STATUS s;

	batch_stream = fopen(batch_file, "r");

	if (batch_stream == NULL) {
		printError();
		return 1;
	}

	for (s = readInput(batch_stream, &cmdLine);
		 (s != INPUT_READ_EOF) && (s != INPUT_READ_ERROR);
		 s = readInput(batch_stream, &cmdLine)) {

		if (s == INPUT_READ_OVERFLOW) {
			display_full_command(cmdLine);
			free(cmdLine);
			continue;
		}
		run_cmd(cmdLine, BATCH_MODE);
	}
	fclose(batch_stream);
	return 0;
}
开发者ID:smihir,项目名称:homework,代码行数:27,代码来源:mysh.c


示例4: main

int main(int argc, char** argv)
{
    int grid_rows = 0, grid_cols = 0, iterations = 0;
    float *MatrixTemp = NULL, *MatrixPower = NULL;
    char tfile[] = "temp.dat";
    char pfile[] = "power.dat";
    char ofile[] = "output.dat";

    if (argc >= 3) {
        grid_rows = atoi(argv[1]);
        grid_cols = atoi(argv[1]);
        iterations = atoi(argv[2]);
        if (argc >= 4)  setenv("BLOCKSIZE", argv[3], 1);
        if (argc >= 5) {
          setenv("HEIGHT", argv[4], 1);
          pyramid_height = atoi(argv[4]);
        }
    } else {
        printf("Usage: hotspot grid_rows_and_cols iterations [blocksize]\n");
        return 0;
    }

    // Read the power grid, which is read-only.
    int num_elements = grid_rows * grid_cols;
    MatrixPower = new float[num_elements];
    readInput(MatrixPower, grid_rows, grid_cols, pfile);

    // Read the temperature grid, which will change over time.
    MatrixTemp = new float[num_elements];
    readInput(MatrixTemp, grid_rows, grid_cols, tfile);

    float grid_width = chip_width / grid_cols;
    float grid_height = chip_height / grid_rows;
    float Cap = FACTOR_CHIP * SPEC_HEAT_SI * t_chip * grid_width * grid_height;
    // TODO: Invert Rx, Ry, Rz?
    float Rx = grid_width / (2.0 * K_SI * t_chip * grid_height);
    float Ry = grid_height / (2.0 * K_SI * t_chip * grid_width);
    float Rz = t_chip / (K_SI * grid_height * grid_width);
    float max_slope = MAX_PD / (FACTOR_CHIP * t_chip * SPEC_HEAT_SI);
    float step = PRECISION / max_slope;
    float step_div_Cap = step / Cap;

    struct timeval starttime, endtime;
    long usec;
    runOMPHotspotSetData(MatrixPower, num_elements);
    gettimeofday(&starttime, NULL);
    runOMPHotspot(MatrixTemp, grid_cols, grid_rows, iterations, pyramid_height,
            step_div_Cap, Rx, Ry, Rz);
    gettimeofday(&endtime, NULL);
    usec = ((endtime.tv_sec - starttime.tv_sec) * 1000000 +
            (endtime.tv_usec - starttime.tv_usec));
    printf("Total time=%ld\n", usec);
    writeOutput(MatrixTemp, grid_rows, grid_cols, ofile);

    delete [] MatrixTemp;
    delete [] MatrixPower;
    return 0;
}
开发者ID:DonnieNewell,项目名称:hulkdeer,代码行数:58,代码来源:hotspot-main-OMP.cpp


示例5: main

int main(){
    char * num1 ;
    char * num2 ;
    num1 = readInput(1);
    num2 = readInput(2);

    printf("\nConverted to int:%d",convert_to_int(num1));
    printf("\nConverted to char:%s",convert_to_char(convert_to_int(num1)));
    printf("\nMax:%d",max(num1,num2,10));
    printf("\nSplit at 0-3:%s",split_at(num1,0,3));
    printf("\nSplit at 3-5:%s",split_at(num1,3,strlen(num1)));
    printf("\nKaratsuba:%d",karatSuba(num1,num2));

    return 0 ;
}
开发者ID:kizzlebot,项目名称:Computer-Science-II,代码行数:15,代码来源:karatsuba.c


示例6: init

// Initialization. Models, textures, program input and graphics definitions
void init (void)
{
	glClearColor (0.0f, 0.0f, 0.0f, 0.0f);

    // Model loading based on each scale
	model1 = readModel (model1Path, model1Scale);
	model1 -> size = model1Size;
	model2 = readModel (model2Path, model2Scale);
	model2 -> size = model2Size;
    
    // Textures configuration in general
	configTextMode();

    // Read the program input (not user input) to determinw hoe many rooms
    //  and theirs objects will be drawn
	readInput();

	// Light. The light switch is made in the input.cpp.
    // Switch it pressing the key L. Do it!
    if (light)
    {
        GLfloat light_position[] = {1.0, 1.0, 1.0, 0.0};
        GLfloat light_diffuse[] = {0.9, 0.9, 0.9, 0.0};
        GLfloat light_ambient[] = {1.4, 1.4, 1.4, 0.0};
        glLightfv(GL_LIGHT0, GL_POSITION, light_position);
        glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
        glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
        glEnable(GL_LIGHTING);
        glEnable(GL_LIGHT0);
    }

	glEnable(GL_DEPTH_TEST);

	glShadeModel(GL_SMOOTH);
}
开发者ID:matheusamazonas,项目名称:picg-project1,代码行数:36,代码来源:main.cpp


示例7: readInput

void Ghdb::prompt ( void ) {
	int ret = GHDB_OK ;
	ret = readInput ( "ghdb", 0 ) ;
	
	if ( ret ) {
		return ;
	}
	
	//Input string
	std::string textInput = _cmdBuffer ;
	//Split the inputing sentence.
	std::vector<std::string> textVec ;
	split ( textInput, SPACE, textVec ) ;
	int count = 0 ;
	std::string cmd = "" ;
	std::vector<std::string> optionVec ;
	
	std::vector<std::string>::iterator iter = textVec.begin() ;
	//handle different command here.
	ICommand* pCmd = NULL ;
	for ( ; iter != textVec.end(); ++iter ) {
		std::string str = *iter ;
		if ( 0 == count ) {
			cmd = str ;
			count ++ ;
		} else {
			optionVec.push_back(str) ;
		}
	}
	pCmd = _cmdFactory.getCommandProcessor ( cmd.c_str() ) ;
	if ( NULL != pCmd ) {
		pCmd -> execute ( _sock, optionVec ) ;
	}
}
开发者ID:Apulus,项目名称:simple_thread_pool,代码行数:34,代码来源:ghdb.cpp


示例8: Init_Problem_1

void Init_Problem_1 ( )
//======================================================================
// XZones = 2, YZones = 1, ZZones = 2, ALL hexahedra
{
  FILE *inputDeck;
  char fileName[100];

  strcpy(fileName,"problem1.cmg");

/*   printf("using input deck:  %s\n",fileName); */
  
  /*Open the file to parse */
  inputDeck = fopen(fileName, "r");

  /*print the prompt*/
  CMGDPRINT("CMG > ");
  
  readInput(inputDeck);
 
  int success = fclose(inputDeck);

  bcastinp( );
   
  cgenmesh();

/*   printf("CMG initialization completed for ==========> PROBLEM # 1\n"); */
}
开发者ID:ngholka,项目名称:patki-power,代码行数:27,代码来源:C2K-CMG.c


示例9: Init_CMG_Problem_From_File

void Init_CMG_Problem_From_File  (const char* meshFile)
//======================================================================
{
  FILE *inputDeck;
  char fileName[100];

  strcpy(fileName,meshFile);

/*   printf("using input deck:  %s\n",fileName); */
  
  /*Open the file to parse */
  inputDeck = fopen(fileName, "r");

  /*print the prompt*/
  CMGDPRINT("CMG > ");
  
  readInput(inputDeck);
 
  int success = fclose(inputDeck);

  bcastinp( );
   
  cgenmesh();

/*   printf("CMG initialization completed for ==========> PROBLEM # 1\n"); */

}
开发者ID:ngholka,项目名称:patki-power,代码行数:27,代码来源:C2K-CMG.c


示例10: main

//stores the input image, resizes with seam carving, and generates the output image
int main(int argc, char *argv[]) {
    MPI_Init(&argc, &argv);
    MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);

    if (!readInput(argv[1])) {
        MPI_Abort(MPI_COMM_WORLD, 1);
    }

    //get the output width and height
    target_width = atoi(argv[3]);
    target_height = atoi(argv[4]);

    //exit if the output dimensions are larger than the input image dimensions
    if (initial_width < target_width || initial_height < target_height) {
        printf("Error: Desired output image dimensions larger than input image dimensions.\n");
        MPI_Abort(MPI_COMM_WORLD, 1);
    }

    image_energy = (double *) malloc(initial_width * initial_height * sizeof(double));
    path_costs = (double *) malloc(initial_width * initial_height * sizeof(double));
    previous_x = (int *) malloc(initial_width * initial_height * sizeof(int));
    previous_y = (int *) malloc(initial_width * initial_height * sizeof(int));
    n = initial_width * initial_height;

    if (image_energy == NULL || path_costs == NULL || previous_x == NULL || previous_y == NULL) {
        printf("problem");
    }

    assignPixels();

    //remove vertical seams until reaching the target width
    while (current_width > target_width) {
        //calculate the energy of the image
        computeImageEnergy();
        //remove the seam
        removeVerticalSeam();
    }

    //remove horizontal seams until reaching the target height
    while (current_height > target_height) {
        //calculate the energy of the image
        computeImageEnergy();
        //remove the seam
        removeHorizontalSeam();
    }

    if (rank == 0) {
        outputCarved(argv[2]);
    }

    free(image_energy);
    free(path_costs);
    free(previous_x);
    free(previous_y);

    MPI_Finalize();

    return 0;
}
开发者ID:vkonen1,项目名称:cmsc483,代码行数:61,代码来源:seam_carver.cpp


示例11: readInput

Device2D Run2D::createDevice2D(int argc, char** argv) {
	std::map<std::string, Material> matLib = readInput(argc, argv);
	std::vector<Device1D> dev1DList;
	Device2D dev2D;
	int accu = 0; // accumalated layer num

	// construct all device1D
	for (int i = 0; i < io2D.blockNum; i++) { // for each block
		dev1DList.push_back(createDevice1D(io2D, matLib, accu, i));
		accu = accu + io2D.layerNumList[i]; // update accu
	}

	std::cout << " **** dev1DList is completed with size = " << dev1DList.size() << std::endl;

	// construct device2D
	dev2D.startWith_2D(dev1DList[0], io2D.blockLength[0], io2D.blockPoint[0], io2D.leftBT);

	for (int i = 1; i < io2D.blockNum -1; i++) {
		dev2D.add_2D(dev1DList[i], io2D.blockLength[i], io2D.blockPoint[i]);
	}
	dev2D.endWith_2D(dev1DList[io2D.blockNum - 1], io2D.blockLength[io2D.blockNum - 1],
			io2D.blockPoint[io2D.blockNum - 1], io2D.rightBT);
	dev2D.matrixDiff_2D();

	std::cout << " **** Device2D is completed." << std::endl;
	return ( dev2D );
}
开发者ID:Oscarlight,项目名称:leno,代码行数:27,代码来源:Run2D.cpp


示例12: main

int main(int argc, char *argv[]) {
    FILE* input = NULL;
    Queue *source = initq();
    int option;
    while ((option = getopt(argc, argv, "hv")) != EOF) {
        switch (option) {
        case 'h':
            usage();
            break;
        case 'v':
            printf("bf version %s\nCopyright (c) %s, %s\nX11 license\n", VERSION, YEAR, AUTHOR);
            exit(0);
            break;
        default:
            usage();
            break;
        }
    }
    if (argv[optind] == NULL)
        usage();
    else if ((input = fopen(argv[1], "r")) == NULL) {
        error(NO_FILE, "main");
    } else {
        readInput(input, source);
        fclose(input);
        execute(source);
        delq(source);
    }
    return 0;
}
开发者ID:frp-2718,项目名称:bf,代码行数:30,代码来源:bf.c


示例13: simulate

void simulate()
{
	printf("Blood bank inventory management simulation.\n");
	if ((infile = fopen("bloodbank.in", "r")) == NULL) {
		printf("Can't find the file: bloodbank.in\n");
		exit(1);
	}
	if ((outfile = fopen("bloodbank.out", "w")) == NULL) {
		printf("Can't create the file: bloodbank.out\n");
		exit(1);
	}
	readInput();

	init_simlib();

	// Schedule first event

	event_schedule(sim_time + 0, EVENT_BLOOD_ARRIVAL); //first arrival from camp at beginning
	event_schedule(sim_time + 0, EVENT_BLOOD_DONATION); //first donation at beginning
	event_schedule(sim_time + 1, EVENT_BLOOD_DEMAND); //first demand next day


	event_schedule(max_sim_time, EVENT_END_SIMULATION);

	eventLoop();
	report();

	fclose(infile);
	fclose(outfile);
}
开发者ID:davidsteinar,项目名称:Blodbanki,代码行数:30,代码来源:BlodbankiSim.c


示例14: main

int main(void){
  int arr[2];
  readInput(arr);
  printf(" loop x^y : %d \n", powerLoop(arr[0],arr[1]));
  printf(" recursive: %d \n", powerRecursive(arr[0],arr[1]));
  return 0;
}
开发者ID:jpotecki,项目名称:COMP101P,代码行数:7,代码来源:q3_2.c


示例15: sanitize

//////////////////////////////////////////////////////////////////////////////
///
///	Read the input stream
///
//////////////////////////////////////////////////////////////////////////////
void controller::readInputStream(unsigned char* ptr) {
 int position;
 sanitize(ptr, &position);
 bool isOverflow = false;

 // Validate input stream
 while (!isValidCommand(ptr) || isDividedByZeroDetected(ptr)) {
  // Prevent to have a string with no operation or with invalid operands
  if (isLFDetected(ptr)
    && (!isOperationDetected(ptr) || !isOperand1Detected(ptr)
      || !isOperand2Detected(ptr))) {
   sanitize(ptr, &position);
   displayMessage((char*) "Invalid input string\n");
   isOverflow = false;
  }

  if (isDividedByZeroDetected(ptr)) {
   sanitize(ptr, &position);
   displayMessage((char*) "Division by zero detected\n");
   isOverflow = false;
  }

  ptr[position++] = (unsigned char) readInput();

  // Loop in array
  if (position == 20) {
   sanitize(ptr, &position);
   if (!isOverflow)
    displayMessage((char*) "String too long, try again\n");
   isOverflow = true;
  }
 }
}
开发者ID:Marvens,项目名称:inf3610lab4,代码行数:38,代码来源:controller.cpp


示例16: lock

long SoundSourceFFmpeg::seek(long filepos)
{
    int ret = 0;
    int hours, mins, secs;
    long fspos, diff;
    AVRational time_base = pFormatCtx->streams[audioStream]->time_base;

    lock();

    fspos = mixxx2ffmpeg(filepos, time_base);
    //  qDebug() << "ffmpeg: seek0.5 " << packet.pos << "ld -- " << packet.duration << " -- " << pFormatCtx->streams[audioStream]->cur_dts << "ld";
    qDebug() << "ffmpeg: seek (ffpos " << fspos << "d) (mixxxpos " << filepos << "d)";

    ret = av_seek_frame(pFormatCtx, audioStream, fspos, AVSEEK_FLAG_BACKWARD /*AVSEEK_FLAG_ANY*/);

    if (ret){
        qDebug() << "ffmpeg: Seek ERROR ret(" << ret << ") filepos(" << filepos << "d) at file"
                 << m_qFilename;
        unlock();
        return 0;
    }

    readInput();
    diff = ffmpeg2mixxx(fspos - pFormatCtx->streams[audioStream]->cur_dts, time_base);
    qDebug() << "ffmpeg: seeked (dts " << pFormatCtx->streams[audioStream]->cur_dts << ") (diff " << diff << ") (diff " << fspos - pFormatCtx->streams[audioStream]->cur_dts << ")";

    bufferOffset = 0; //diff;
    if (bufferOffset > bufferSize) {
        qDebug() << "ffmpeg: ERROR BAD OFFFFFFSET, buffsize: " << bufferSize << " offset: " << bufferOffset;
        bufferOffset = 0;
    }
    unlock();
    return filepos;
}
开发者ID:AlbanBedel,项目名称:mixxx,代码行数:34,代码来源:soundsourceffmpeg.cpp


示例17: main

int main() {
	readInput();
	if ( tokenize() ) {
		printSymbolTable();
	}
	
}
开发者ID:dw6,项目名称:NUS,代码行数:7,代码来源:ProblemSet1_2.c


示例18: ofSoundUpdate

//--------------------------------------------------------------
void testApp::update()
{
	// Nécessaire pour le moteur de sons d'Openframeworks
	ofSoundUpdate();

	// Nécessaire pour la mise à jour du GPIO
	updateInputOutput();

	//
	if (!listSounds[0].getIsPlaying()){
		playSound(0);
	}

	// Exemple de lecture depuis une entrée
	// Puis écriture sur la sortir "/output0"
	int value = readInput(5);
	if (value>0)
	{
		soundVolumeTarget = 0.0f;
		soundVolume += (soundVolumeTarget-soundVolume)*0.2;
	}
	else
	{
		ofLogNotice() << "touch detected";
		soundVolumeTarget = 1.0f;
		soundVolume += (soundVolumeTarget-soundVolume)*0.7;
	}

	listSounds[0].setVolume(soundVolume);
}
开发者ID:alx-s,项目名称:ABCDerres,代码行数:31,代码来源:testApp.cpp


示例19: readInput

rCode AtWrapper::CatchResponse(bool debug = false) {

	char in[RESPONSE_BUFFER] = {0};
	int bytesReaded = 0;
	bytesReaded = readInput((char*) in, RESPONSE_BUFFER);

	String input(in);

	if(bytesReaded > 0){

		//Debug received command from device
		if(debug){
			Serial.print("Input was: ");
			Serial.print(input);
			Serial.println("");
		}

		//Parse received command
		if(input.substring(0,3) == "ROK"){
			return EBU_RESETOK;
		} else if (input.substring(0,2) == "OK") {
			return EBU_SETTEDOK;
		} else if (input.substring(0,5) == "+RCOI") {
			this->client = input.substring(6,19);
			return EBU_INPUTCONNREQUEST;
		} else if (input.substring(0,3) == "ERR") {
			return EBU_ERROR;
		}

		return EBU_UNDEFINED;
	}
	return EBU_NORESPONSE;
}
开发者ID:jDomenech,项目名称:ThePunchGame,代码行数:33,代码来源:AtWrapper.cpp


示例20: defined

 MyMD::MyMD() {

 /* Obtain the number of threads. */
 #if defined(_OPENMP)
 #pragma omp parallel
     {
	 if(0 == omp_get_thread_num()) {
	     nthreads=omp_get_num_threads();
	     printf("Running OpenMP version using %d threads\n", nthreads);
	 }
     }
 #else
     nthreads=1;
 #endif

   /* Read input and allocate classes memory. */
  allocateMemory();
  readInput();

  /* Load initial position and velocity. */ 
  readRestart();

  /* Open energy and trajectory output files. */
  erg=fopen(ergfile,"w");
  traj=fopen(trajfile,"w");

  /* Initializes forces and energies. */
  nfi = 0;
  integrator->UpdateCells();
  force->ComputeForce(atoms);
  integrator->CalcKinEnergy();
}
开发者ID:Rhouli,项目名称:ljmd-c,代码行数:32,代码来源:MyMD.cpp



注:本文中的readInput函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ readInt函数代码示例发布时间:2022-05-30
下一篇:
C++ readImage函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap