Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C by harrykuo1 ( 6 years ago )
#include<stdio.h>
#include<string.h>
#include <math.h>
char str[1000];
int ary[100];

int string_to_int(char *arr){
	int num=0;
	for(int i=0;i<strlen(arr);i++){
		num+=(arr[i]-'0')*pow(10,strlen(arr)-i-1);
	}
	return num;
}

int main(){
	gets(str);
	char *input;
	input = strtok(str," ");
	int index=0;
	while(input != NULL){
		index++;
		ary[index] = string_to_int(input);
		input = strtok(NULL," ");
	}
}

 

Revise this Paste

Your Name: Code Language: