simple program for char-int
Hello i am having problems transforming program from char - int
Code:
// program that transforms charicters in to integer
#include <iostream.h>
#include <cstring.h>
using namespace std;
int main() {
char string[256];
int a[3];
int b[3];
cout << "input - x345 j5678 k345 ";
//i know that my input lines will be always the same,
//only the numbers will be cahnging.
cin.getline << string;
cout << "your line: " << string << endl;
//i know thet in filds 1,2,3 of string there are numbers
//how can i make this numbers to go to integer a so that i culd
//use mathematical operations on tham?
cout <<" &string[1] " << &string[1] <<endl;
//this inputs the pointer to string[1] and it displays lines from 1 - last
a = &string[1];
cout <<" a = " << a <<endl;
//i used this function couse a can only have 3 numbers
// so in theory it shuld haven numbers 345
//instead it writes 54 or something
b = string[1];
//if i use this line it displays an error
//you can not transform char in to int
cin.get();
//how can i fiks the program, so that i culd read numbers as integers?
}