#include<stdio.h>
#define UPPER 999999
#define LOWER 11111
int main(void)
{
// Local Declarations
double price = 89.99;
char grade = 'B';
int age = 97;
// Statements
printf("Homework 2:\n\nUsing printf\n");
printf(" age = %c, age\n");
printf("grade = %d, grade\n");
printf("price = %f, price\n\n");
printf("Using both printf and scanf\n");
printf("Enter a new value for age: ");
scanf("%d", &age);
printf("Enter a new value for grade: ");
scanf("%c", &grade);
printf("Enter a new value for price: ");
scanf("%lf", &price);
printf("Print the new values\n");
printf(" age = %d \n", age);
printf("grade = %c\n", grade);
printf("price = %lf\n\n", price);
print("\n\nPrinting two defined constants: "UPPER" and "LOWER"\n");
print("UPPER = %08d\n", UPPER);
print("LOWER = %08d\n", LOWER);
return 0;
} // end of main
以上是我的程序,我应该修复它。我已经用了将近 3 个小时了,现在仍然可以找出问题所在。我有一个错误和一些警告。
warning: too few arguments for format
中间体语句的几个警告
error: expected ')' before numeric constant
此错误用于打印两个常量。