[ create a new paste ] login | about

Link: http://codepad.org/c6JoEWop    [ raw code | output | fork ]

C++, pasted on Mar 13:
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>

using namespace std;

void conversion(vector<string> init)	//把string轉換成int
{
	for(vector<string>::size_type i = 0; i != init.size(); i++)
	{
		if(isdigit(init[i]))	//問題出在這裡
		{

		}
	}
}

int main()
{
	string input;
	vector<string> store;	//把輸入的字串存進去
	vector<int> storeNum;	//存字串中的數字
	int place = 0;

	while(cin >> input)
	{
		store.push_back(input);
		/*
		istringstream reg(store[place]);
		int regInt;
		reg >> regInt;
		storeNum.push_back(regInt);
		*/
		place++;
	}

	system("Pause");
	
	return 0;
}


Output:
1
2
3
In function 'void conversion(__gnu_debug_def::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >)':
Line 14: error: no matching function for call to 'isdigit(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: