How can I get specified number?
For example, the number that a user enters is 4568962358.
I want to save the "96" in a variable; how do I get just the 96 or 23?
This is the real problem:
An important shipping company is making the annual inventory of the goods they have in their warehouse, for which they have implemented a system of codes that are assigned to each good that is in said warehouse. This code, which consists of 16 digits, contains the following information: unique number, indicator of whether it is fragile or not, place of origin of the property and expiration date of the property.
 
The assigned code structure is UUUFPPPPDDMMAAAA where:
- UUU: unique number of the good.
- F: digit that indicates if the good is fragile or not. If it is 0 it means that it is fragile.
- PPPP: ASCII codes of the two letters that identify the country of origin of the good.
- DD: Good's due date.
- MM: Month of the expiration of the good.
- AAAA: Year of expiration of the good.
You are asked to create a C ++ program that receives the assigned code as data and then prints the following data as shown in the example.
Enter the code: 1120677212042015
Then the program must print: Unique number: 112. Fragile(N: No; S: Yes): S . Country of origin: CH . Day, month and year of expiration: 04-12-2015 . Well it is outdated to date (N : No; S: Yes): S.
In the solution of the problem you will not be able to make use of selective structures.
Version 1
#include "stdafx.h"
#include "conio.h"
#include "iostream"
using namespace System;
using namespace std;
int main()
{
    int code;
    int UUU;
    int F;
    int PP1,PP2;
    int DD;
    int MM;
    int AAAA;
    cout << "Enter the code: "; cin >> code; // 1120677212042015
    // ...code needed here
    UUU = int(code / 10000000000000);
    cout << "\nRESULTS" << endl;
    cout << "\nUnique number: " << UUU << endl; // prints 112
    _getch();
    return 0;
}
Version 2
I'm not able to do the next parts; please help!
#include "stdafx.h"
#include "conio.h"
#include "iostream"
using namespace System;
using namespace std;
int main()
{
    double code;
    double UUU;
    double F;
    double PP1,PP2;
    double DD;
    double MM;
    double AAAA;
    cout << "Enter the code: "; cin >> code; // 1120677212042015 
    UUU = int(code / 10000000000000);
    PP1 = int(code / 10000000000) % 100;
    PP2 = int(code / 100000000) % 100;
    DD = int(code / 1000000) % 100;
    cout << "\nRESULTS" << endl;
    cout << "\nUnique number: " << UUU << endl; // 112
    cout << "Country of origin: " << (char)PP1 << (char)PP2<<endl; //CH
    cout << "Day, Month and Year of expiration: " << DD; // 12/../....
    _getch();
    return 0;
}
 
     
     
     
    