您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ strToInt函数代码示例

51自学网 2021-06-03 08:25:34
  C++
这篇教程C++ strToInt函数代码示例写得很实用,希望能帮到您。

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

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

示例1: get_parameter

/** * Handles getting a parameter for an opcode */void get_parameter() {	int nvalue;	if (token == NUMBER) {		literal.value.integer	= strToInt(token_string);		return;	}	if (token != IDENTIFIER)		return;	nvalue = symbolFind();	if (nvalue != -1) {		// Found symbol, so get it's numeric value and return		token = NUMBER;		literal.value.integer	= strToInt(symbolTable[nvalue].value);		return;	}	// Check if the parameter is the name of an already processed subroutine	strToLower(token_string);	nvalue = subIndexOf();	if (nvalue == -1) {		token = ERROR;		return;	}	// Store the index (not the offset) of the subroutine to call	token = NUMBER;	literal.value.integer = nvalue;}
开发者ID:St0rmcrow,项目名称:scummvm,代码行数:34,


示例2: debugPrintf

/** * This command loads up the specified new scene number */bool Debugger::Cmd_Scene(int argc, const char **argv) {	if (argc < 2) {		debugPrintf("Usage: %s <scene number> [<x> <y>]/n", argv[0]);		return true;	}	int sceneNumber = strToInt(argv[1]);	if (sceneNumber >= g_vm->_theBoxes.getLocBoxesCount()) {		debugPrintf("Invalid scene/n");		return true;	}	RMPoint scenePos;	if (argc >= 4) {		scenePos._x = strToInt(argv[2]);		scenePos._y = strToInt(argv[3]);	} else {		// Get the box areas for the scene, and choose one so as to have a default		// position for Tony that will be in the walkable areas		RMBoxLoc *box = g_vm->_theBoxes.getBoxes(sceneNumber);		scenePos.set(box->_boxes[0]._hotspot[0]._hotx, box->_boxes[0]._hotspot[0]._hoty);	}	// Set up a process to change the scene	ChangeSceneDetails details;	details.sceneNumber = sceneNumber;	details.x = scenePos._x;	details.y = scenePos._y;	CoroScheduler.createProcess(DebugChangeScene, &details, sizeof(ChangeSceneDetails));	return false;}
开发者ID:AReim1982,项目名称:scummvm,代码行数:35,


示例3: main

int main(void){  printf ("%i/n", strToInt("245"));  printf ("%i/n", strToInt("100") + 25);  printf ("%i/n", strToInt("13x5"));  return 0;}
开发者ID:yash1th,项目名称:cprogramming,代码行数:7,


示例4: setRTCFromText

void setRTCFromText(char *time) {	// This function parses the date and or time using any of the following format:	//  1. #h#m#s	//  2. #m#d	//  3. #m#d#h#m#s	//  where '#' represents any valid positive integer.  	//  Note that 'm' is used for month and for minute. 'm' will mean month, unless it follows an 'h'.	//  Note that year is not set because it is used to indicate the time period (see cold_start code)		int month = -1, date = -1, hour = -1, min = -1, sec = -1;	char *ptr;		if ((ptr = findTimePart(time,'m'))) {		month = strToInt(ptr);		if ((ptr = findTimePart(time,'d')))			date = strToInt(ptr);		else 			month = -1;	}	if ((ptr = findTimePart(time,'h'))) {		hour = strToInt(ptr);		if ((ptr = findTimePart(ptr,'m')))			min = strToInt(ptr);		if ((ptr = findTimePart(ptr,'s')))			sec = strToInt(ptr);	}	if (month >= 1 && date >= 1)		setDate(month,date);	if (hour >= 0 && min >= 0 && sec >= 0)		setRTC(hour,min,sec);}
开发者ID:billev,项目名称:literacybridge,代码行数:31,


示例5: importNewSystemData

extern void importNewSystemData (LPSTR importFile) {	struct SystemData sd;	int handle;	char buffer[READ_LENGTH+1];	char *name, *value;		memset(&sd,0,sizeof(struct SystemData));	buffer[READ_LENGTH] = '/0'; //prevents readLine from searching for /n past buffer	handle = tbOpen(importFile,O_RDONLY);	while (nextNameValuePair(handle, buffer, ':', &name, &value)) {		if (!value)			continue;		// test there is a new line and that it isn't a comment (starting with "#")		if(*name == '#')			continue;		if (!strcmp(name,(char *)"SRN")) LBstrncpy(sd.serialNumber,trim(value),SRN_MAX_LENGTH);			else if (!strcmp(name,(char *)"REFLASH")) sd.countReflashes=strToInt(value);			else if (!strcmp(name,(char *)"IMAGE")) LBstrncpy(sd.imageName,trim(value),IMAGENAME_MAX_LENGTH);			else if (!strcmp(name,(char *)"UPDATE")) LBstrncpy(sd.updateNumber,trim(value),UPDATENUMBER_MAX_LENGTH);			else if (!strcmp(name,(char *)"LOCATION")) LBstrncpy(sd.location,trim(value),LOCATION_MAX_LENGTH);			else if (!strcmp(name,(char *)"YEAR")) sd.yearLastUpdated=strToInt(value);			else if (!strcmp(name,(char *)"MONTH")) sd.monthLastUpdated=strToInt(value);			else if (!strcmp(name,(char *)"DATE")) sd.dateLastUpdated=strToInt(value);	}	close(handle);	setSystemData(&sd);	}
开发者ID:billev,项目名称:literacybridge,代码行数:28,


示例6: strToInt

bool Debugger::cmd_enterRoom(int argc, const char **argv) {	Resources &res = Resources::getReference();	Room &room = Room::getReference();	uint remoteFlag = 0;	if (argc > 1) {		int roomNumber = strToInt(argv[1]);		// Validate that it's an existing room		if (res.getRoom(roomNumber) == NULL) {			DebugPrintf("specified number was not a valid room/n");			return true;		}		if (argc > 2) {			remoteFlag = strToInt(argv[2]);		}		room.leaveRoom();		room.setRoomNumber(roomNumber);		if (!remoteFlag)			res.getActiveHotspot(PLAYER_ID)->setRoomNumber(roomNumber);		detach();		return false;	}	DebugPrintf("Syntax: room <roomnum> [<remoteview>]/n");	DebugPrintf("A non-zero value for reomteview will change the room without ");	DebugPrintf("moving the player./n");	return true;}
开发者ID:MaddTheSane,项目名称:scummvm,代码行数:32,


示例7: main

int main (void){    int strToInt (const char str[]);    printf ("%i/n", strToInt("-245"));    printf ("%i/n", strToInt("100") + 25);    printf ("%i/n", strToInt("135"));    return 0;}
开发者ID:hakrlife,项目名称:bhuvan,代码行数:8,


示例8: DebugPrintf

/** * This command loads up the specified screen number */bool HugoConsole::Cmd_gotoScreen(int argc, const char **argv) {	if ((argc != 2) || (strToInt(argv[1]) > _vm->_numScreens)){		DebugPrintf("Usage: %s <screen number>/n", argv[0]);		return true;	}	_vm->_scheduler->newScreen(strToInt(argv[1]));	return false;}
开发者ID:33d,项目名称:scummvm,代码行数:12,


示例9: main

int main(void){    int strToInt (const char numericString[]);    printf ("%i/n", strToInt("245"));    printf ("%i/n", strToInt("100") + 25);    printf ("%i/n", strToInt("13x5"));    printf ("%i/n", strToInt("-405"));    return 0;}
开发者ID:zzankov,项目名称:oss-computer-science,代码行数:10,


示例10: sh_memfree

void sh_memfree(char* params){	int i;	for(i=0;i<strLen(params);i++){		if(params[i] == ' ') break;	}	params[i] = 0;	void* pointer = (void*) ((int*)strToInt(params));	int value = strToInt(params+i+1);	free(pointer, value);}
开发者ID:kevinsa5,项目名称:KevinOS,代码行数:10,


示例11: main

int main(void) {    int strToInt(const char string[]);    printf("%i /n", strToInt("435"));    printf("%i /n", strToInt("435") + 25);    printf("%i /n", strToInt("43*5"));    return 0;}
开发者ID:hakrlife,项目名称:ayyanar,代码行数:10,


示例12: OutputTable

void OutputTable (SItemTableCtx &Ctx, const SItemTypeList &ItemList)	{	int i, j;	if (ItemList.GetCount() == 0)		return;	//	Output each row	for (i = 0; i < ItemList.GetCount(); i++)		{		CItemType *pType = ItemList[i];		for (j = 0; j < Ctx.Cols.GetCount(); j++)			{			if (j != 0)				printf("/t");			const CString &sField = Ctx.Cols[j];			//	Get the field value			CString sValue;			CItem Item(pType, 1);			CItemCtx ItemCtx(Item);			CCodeChainCtx CCCtx;			ICCItem *pResult = Item.GetProperty(&CCCtx, ItemCtx, sField);			if (pResult->IsNil())				sValue = NULL_STR;			else				sValue = pResult->Print(&g_pUniverse->GetCC(), PRFLAG_NO_QUOTES | PRFLAG_ENCODE_FOR_DISPLAY);			pResult->Discard(&g_pUniverse->GetCC());			//	Format the value			if (strEquals(sField, FIELD_AVERAGE_DAMAGE) || strEquals(sField, FIELD_POWER_PER_SHOT))				printf("%.2f", strToInt(sValue, 0, NULL) / 1000.0);			else if (strEquals(sField, FIELD_POWER))				printf("%.1f", strToInt(sValue, 0, NULL) / 1000.0);			else if (strEquals(sField, FIELD_TOTAL_COUNT))				{				SDesignTypeInfo *pInfo = Ctx.TotalCount.GetAt(pType->GetUNID());				double rCount = (pInfo ? pInfo->rPerGameMeanCount : 0.0);				printf("%.2f", rCount);				}			else				printf(sValue.GetASCIIZPointer());			}		printf("/n");		}	}
开发者ID:bmer,项目名称:Transmuter,代码行数:55,


示例13: p9_ex11

int p9_ex11(void){	printf("%i/n", strToInt("245"));	printf("%i/n", strToInt("245") + 25);	printf("%i/n", strToInt("13x5"));	printf("%i/n", strToInt("-245"));	return 0;}
开发者ID:crazyrumer,项目名称:ProgrammingInC,代码行数:11,


示例14: main

int main(){    int n;    scanf("%d",&n);    char *str1,*str2;    str1=(char*)malloc(sizeof(char)*8);    str2=(char*)malloc(sizeof(char)*8);    while(n--){        scanf("%s %s",str1,str2);        intToStr(strToInt(str1)+strToInt(str2));    }    return 0;}
开发者ID:josercl,项目名称:spoj,代码行数:12,


示例15: DebugPrintf

/** * This command loads up the specified new scene number */bool Debugger::Cmd_Scene(int argc, const char **argv) {	if (argc < 2) {		DebugPrintf("Usage: %s <scene number> [prior scene #]/n", argv[0]);		return true;	}	if (argc == 3)		g_globals->_sceneManager._sceneNumber = strToInt(argv[2]);	g_globals->_sceneManager.changeScene(strToInt(argv[1]));	return false;}
开发者ID:AdamRi,项目名称:scummvm-pink,代码行数:15,


示例16: main

int main() {  char *sInput = "874";  switch( isVaildInt(sInput) ) {    case 0: //pos number      printf("%d/n", strToInt(sInput, 1));      break;    case 1: //neg number      printf("%d/n", strToInt(sInput+1, -1));      break;    case 2:       printf("inVaildNum/n");break;  }}
开发者ID:quanta2015,项目名称:CLanguage,代码行数:14,


示例17: udbBacktrace

int udbBacktrace(int argc, char* argv[]) {    subArgv[0] = buf;    subArgv[1] = 0;    int result = doSysDebug(DEBUG_BACKTRACE, subArgv);    char** res = split(buf);    for(int i = 0; res[i]; i += 2) {        uint32_t ebp = strToInt(res[i]);        uint32_t eip = strToInt(res[i + 1]);        struct DebugInfo* deb = findSline(eip);        cprintf(            "0x%08x in %s (ebp=%08x, eip=%08x) at %s:%d/n",             eip, deb->func->symStr, ebp, eip, deb->soStr, deb->sourceLine);    }}
开发者ID:tansinan,项目名称:ucore_plus,代码行数:14,


示例18: readSequenceAnnotationContent

static void readSequenceAnnotationContent(xmlNode *node) {	SequenceAnnotation *ann;	xmlChar *ann_uri;	xmlChar *path;	xmlChar *contents;	xmlNode *child_node; // structured xml annotation	int i;	// create SequenceAnnotation	ann_uri = getNodeURI(node);	ann = createSequenceAnnotation(DESTINATION, (char *)ann_uri);	xmlFree(ann_uri);	// add bioStart	path = BAD_CAST "./" NSPREFIX_SBOL ":" NODENAME_BIOSTART;	if ((contents = getContentsOfNodeMatchingXPath(node, path))) {		setSequenceAnnotationStart(ann, strToInt((char *)contents));		xmlFree(contents);	}	// add bioEnd	path = BAD_CAST "./" NSPREFIX_SBOL ":" NODENAME_BIOEND;        if ((contents = getContentsOfNodeMatchingXPath(node, path))) {		setSequenceAnnotationEnd(ann, strToInt((char *)contents));		xmlFree(contents);	}	// add strand	path = BAD_CAST "./" NSPREFIX_SBOL ":" NODENAME_STRAND;        if ((contents = getContentsOfNodeMatchingXPath(node, path))) {		setSequenceAnnotationStrand(ann, strToPolarity((char *)contents));		xmlFree(contents);	}	// scan other xml nodes attached to this Annotation for structured xml annotations	// @TODO factor out this block of code.  This routine is generally used by each of the SBOL core objects	// but it requires some custom knowledge of the calling object (in this case, Annotation)	child_node = node->children;	while (child_node) {		if (child_node->ns && !isSBOLNamespace(child_node->ns->href)) {			// copy xml tree and save it in the SBOLDocument object as a structural annotation 			xmlNode* node_copy = xmlDocCopyNode(child_node, ann->doc->xml_doc, 1);			node_copy = xmlAddChild(xmlDocGetRootElement(ann->doc->xml_doc), node_copy);			i = xmlReconciliateNs(ann->doc->xml_doc, xmlDocGetRootElement(ann->doc->xml_doc));			insertPointerIntoArray(ann->base->xml_annotations, node_copy);		}		child_node = child_node->next;	}}
开发者ID:SynBioDex,项目名称:libSBOLc,代码行数:49,


示例19: mul

int mul (char* arg1, char* arg2, char* arg3,		 char* arg4, char* arg5, char* arg6) {	int r = 0xe0000090;	int Rd = strToInt(arg1, MAX_ARG_SIZE);	int Rm = strToInt(arg2, MAX_ARG_SIZE);	int Rs = strToInt(arg3, MAX_ARG_SIZE);	setBitsAt(&r, 16, &Rd, 0, 4);	setBitsAt(&r, 0, &Rm, 0, 4);	setBitsAt(&r, 8, &Rs, 0, 4);	return r;}
开发者ID:aib13,项目名称:arm11_raspberry_pi_as_DMX_show_controller,代码行数:15,


示例20: sh_poke

void sh_poke(char* params){	// poke pointer byte(decimal)	int i;	for(i=0;i<strLen(params);i++){		if(params[i] == ' ') break;	}	char substr[i+1];	memCopy(params,substr,i);	substr[i] = 0;	char* pointer = (char*) ((int*)strToInt(substr));		char substr2[strLen(params)-i];	memCopy(params+i+1,substr2,strLen(params)-i);	int value = strToInt(substr2);	*pointer = value;}
开发者ID:kevinsa5,项目名称:KevinOS,代码行数:16,


示例21: setActiveInputLable

void MenuStateOptionsSound::saveConfig(){	Config &config= Config::getInstance();	Lang &lang= Lang::getInstance();	setActiveInputLable(NULL);	config.setString("FactorySound", listBoxSoundFactory.getSelectedItem());	config.setString("SoundVolumeFx", listBoxVolumeFx.getSelectedItem());	config.setString("SoundVolumeAmbient", listBoxVolumeAmbient.getSelectedItem());	CoreData::getInstance().getMenuMusic()->setVolume(strToInt(listBoxVolumeMusic.getSelectedItem())/100.f);	config.setString("SoundVolumeMusic", listBoxVolumeMusic.getSelectedItem());	config.save();	if(config.getBool("DisableLuaSandbox","false") == true) {		LuaScript::setDisableSandbox(true);	}    SoundRenderer &soundRenderer= SoundRenderer::getInstance();    soundRenderer.stopAllSounds();    program->stopSoundSystem();    soundRenderer.init(program->getWindow());    soundRenderer.loadConfig();    soundRenderer.setMusicVolume(CoreData::getInstance().getMenuMusic());    program->startSoundSystem();    if(CoreData::getInstance().hasMainMenuVideoFilename() == false) {    	soundRenderer.playMusic(CoreData::getInstance().getMenuMusic());    }	Renderer::getInstance().loadConfig();	console.addLine(lang.getString("SettingsSaved"));}
开发者ID:KatrinaHoffert,项目名称:megaglest-source,代码行数:32,


示例22: switch

void CGameSettings::SetValue (int iOption, const CString &sValue, bool bSetSettings)//	SetValue////	Sets the boolean, integer, or string value of the option	{	switch (g_OptionData[iOption].iType)		{		case optionBoolean:			m_Options[iOption].bValue = (strEquals(sValue, CONSTLIT("true")) || strEquals(sValue, CONSTLIT("on")) || strEquals(sValue, CONSTLIT("yes")));			break;		case optionInteger:			m_Options[iOption].iValue = strToInt(sValue, 0);			break;		case optionString:			m_Options[iOption].sValue = sValue;			break;		default:			ASSERT(false);		}	//	Set the settings value, if appropriate	if (bSetSettings)		m_Options[iOption].sSettingsValue = sValue;	}
开发者ID:Sdw195,项目名称:Transcendence,代码行数:30,


示例23: xcmd_flag_not_avaible_status_long

static void xcmd_flag_not_avaible_status_long (const char* const s, const char* const v, void* data){	xcmdPath *path = data;	if(!strToInt(v, 0, &path->not_available_status))		error (FATAL, "Could not parse the value for %s flag: %s", s, v);}
开发者ID:amosbird,项目名称:ctags,代码行数:7,


示例24: main

int main(){    char s[MAX_STR_LEN];    while(gets(s) != NULL)        printf("%d/n", strToInt(s));    return 0;}
开发者ID:GggXp,项目名称:sdust_judge_online,代码行数:7,



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


C++ strV函数代码示例
C++ strTemp函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。