jweinst1
9/7/2016 - 9:51 PM

converting str to int in C++

converting str to int in C++

#include <iostream>
#include <string>
#include "Container.h"

//generic adding function
int concat(int x, int y){
	return x + y;
}

int main() {
	std::string result;
	std::cout << "Give a number" << std::endl;
	std::cin >> result;
	int value = atoi(result.c_str());
	Container a(value);
	std::cout << "You printed" << a.getint() << std::endl;
}