简体   繁体   中英

Converting a cout statement into a /printf statement

I am working on converting C++ to C. How would one covert the following cout line into a printf ?

p = int *p, 
pageRequestIndex, frameIndex = int
cout<<"\nPage "<<p[pageRequestIndex]<<" loaded into Frame "<<frameIndex;
printf("\nPage %d loaded into Frame %d", p[pageRequestIndex], frameIndex);

%d --> for

#include <stdio.h>

int main()
{
    // 5, 10 are the values of the variables you'd use
    printf("\nPage %d loaded into Frame %d", 5, 10);
    
    return 0;
}

Edit: should've posted it right away

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM