+ 1
About variables
I'm new to coding So I don't really understand the use of variables in coding
3 Réponses
+ 5
This question appears to be frequently asked. You can make use of the search bar to get answers to your queries.
In short, variables are simply containers used to store data.
If you are writing a program to add two numbers, you can't just do:
std::cout << 1+1;
This program would print two every time you run it. You may want variables which can be used to store user input, and then compute the result of said user input.
int a, b;
std::cin >> a >> b;
std::cout << a+b;
https://www.sololearn.com/Discuss/11892/?ref=app
https://www.sololearn.com/Discuss/1351993/?ref=app
https://www.sololearn.com/Discuss/125006/?ref=app
+ 5
Why do people who have barely touched the courses (looking at you, OP) ask questions? There should be an SL rule for Q&A: at least 50%-75% of a course done to post.
+ 2
They are containers that hold some data value. Basically their sole purpose is to label and store data in memory. This data can then be used throughout your program.
https://www.sololearn.com/learn/CPlusPlus/1606/
http://www.cplusplus.com/doc/tutorial/variables/