Spliting up a string of numbers?

I am making a basic "encryption" software in C++. I have sorted the encryption bit, but decrypting is a bit harder. The user will enter a string of numbers separated with dots something along the lines of "7654387.4325456.856985.947398.201823.865034865"

What I would like my program to be able to do is to asign the first "group" before the dot to one variable, enabling me to translate it back, and then move on a do the second group.

I did try saying number=message[0]+message[1]+message[2] but this did not work and instead added up the numbers. Someone also told me about getline, but I have no clue on what this is.

Any help?
Last edited on
I have this so far but I am guessing that it is massivley wrong.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include<iostream>
#include<cstring>
using namespace std;
int main ()
{    
char decode_message;   
 int length;  
 //will be like 48657865.435435643.42143256467.243125435.2143214.5683465.4732985793.43278567.13527186.54396984   
 cin>>decode_message;    
length=strlen(decode_message);    
getline(decode_message,length,".")                                           
 for(;;)      
return 0;   }




Last edited on
Topic archived. No new replies allowed.