Here is a small sample program which counts up to 100 in increments of 10.
I use both std::cout and printf to display the value of list in each increment.
Comments added to hopefully help aid you in learning
#include dio> 
int main()
{
    int r = 10;
    int list=0;
    while (list < 100)
    {
        list += r;                 // this is the same as saying list = list + r, but is more succinct
        std::cout << list << "\t"; // cout is in the std namespace, so you have to prefix with std::
        printf("%d\n", list);      // the printf format specified for int is "%d"
    }
}Output:
10 10 20 20 30 30 40 40 50 50 60 60 70 70 80 80 90 90 100 100
Please note that I didn't use using namespace std; at the top to import cout into the global namespace. IMHO this is bad practice, so I typically will prefer std::cout etc.
 
                 
                                             
                         
                        
manpreet![Tuteehub forum best answer]() Best Answer
                                                
                                                                                                        3 years ago
                                                    Best Answer
                                                
                                                                                                        3 years ago
                                                
                                            
I am new learning C++ and I have basic questions and basic troubles :(
I want to print a list of numbers that are coming from the next following while condition:
I want to use printf instead of cout (because I still don´t know why with cout is not working).
Can anyone help me to give me the analogous printf command to
Thanks a lot!!!