answersLogoWhite

0

You can use an array of char type, also you can use type string to save your data, for instance:

int numberLength = 10;//defines how long is your number
char number[numberLength] = '0';
...
cin >> number;

Then you can access separate elements using array notation:
number[0] is a first digit of your number, ..., number[i] is ith element.

You can use string type as well. string type is better because you do not have specify how long your number is going to be!

#include
...
using std::string;
...
string number = "0";//your number initialized with zero
...
cin >> number;

You can access separate digits in the same way as for the previous case:

number[0] gives you first digit,..., number[sizeof number/sizeof number[0] - 1] gives you the last digit.

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

What are the components of a variable?

A variable typically consists of a name, a data type, a value, and a memory location where the value is stored. The name is used to reference the variable in the code, the data type defines the type of data the variable can hold, the value is the actual data stored in the variable, and the memory location is where the value is stored in the computer's memory.


What is an arrangement of numbers that separate the ones digits from the other digits?

2984, 2980


What is a function of a variable?

A variable is a named memory address in which a value may be stored and mutated.


What is session in aspnet?

session is a server variable. it works like the ordinary variable but it is stored on the server


Where the local variables will be stored?

When you declare a variable and it's data type in a function, it is stored in the specific space for memory allocated by the variable type identifier known as the "stack."


Why is it important to separate variable and fixed costs?

it is important to separate variable and fixed costs. Another reason it is important to separate these costs is because variable costs are used to determine the contribution margin, and the contribution margin is used to determine the break-even point.


Where string is stored on Heap or Stack in java?

A String is treated as an object, meaning there is an object on the heap. Of course, the variable you define is a pointer to the object, and it is stored on the stack.A String is treated as an object, meaning there is an object on the heap. Of course, the variable you define is a pointer to the object, and it is stored on the stack.A String is treated as an object, meaning there is an object on the heap. Of course, the variable you define is a pointer to the object, and it is stored on the stack.A String is treated as an object, meaning there is an object on the heap. Of course, the variable you define is a pointer to the object, and it is stored on the stack.


Where is constant variable stored?

Random Access Memory (RAM)


What is a variable made up of?

A variable is made up of a name (identifier) that represents a value stored in a computer's memory. It consists of a memory location where data can be stored and manipulated in a program. The value assigned to a variable can change during program execution.


Where the variables are stored in the computer?

Variable stored in the memory block inside the RAM. whenever we declare a variable it would take space in main memory and consume it's size from RAM.


Where does global variables stored in C?

It depends entirely on what platform you are using. In an embedded environment, for instance global/static variables go into different RAM memory segments depending on whether or not they are initialised. constants are often left in ROM automatic variables are normally placed of the stack of the currently running task but not always.


Are The number of significant digits in a double variable is up to 15?

The maximum number of significant digits in value belonging to the double type is 15. The maximum number of significant digits is called the precision.