简体   繁体   English

将 cout 语句转换为 /printf 语句

[英]Converting a cout statement into a /printf statement

I am working on converting C++ to C.我正在将 C++ 转换为 C。 How would one covert the following cout line into a printf ?如何将以下cout行转换为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 %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编辑:应该马上发布

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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