我需要通过参考传递我的课程。我在标题中遇到了错误,但仅限于功能 divideByTweleve 和 multiplyByEleven。这是为什么?我究竟做错了什么?请帮我解决这个问题。
#include <stdio.h>
void displayMenu();
float addTen (float* number);
float divideByTwelve(float* number);
float subtractSixteen(float* number);
float multiplyByEleven(float* number);
int menu;
float number, finalNumber;
float* ptr_number;
int main (void)
{
float* ptr_number=NULL;
ptr_number=&number;
printf("Please enter a number : ");
scanf("%f", &number);
displayMenu();
scanf("%d", &menu);
do {
printf("\nEnter 5 to see final number\n");
scanf("%d",&menu);
switch (menu)
{
case 1: number=addTen(ptr_number);
break;
case 2: number=divideByTwelve(ptr_number);
break;
case 3: number=subtractSixteen(ptr_number);
break;
case 4: number=multiplyByEleven(ptr_number);
break;
}
printf("Your number is: %.2f \n", number);
}while(menu!=5);//close of the do-while loop
}
void displayMenu()
{
printf("How would you like to manipulate your number\n");
printf("1. Add 10\n");
printf("2. Divide by 12\n");
printf("3. Subtract 16\n");
printf("4. Multiply by 11\n");
}
float addTen (float* number)
{
ptr_number=ptr_number+10;
}
float divideByTwelve (float* number)
{
ptr_number=ptr_number/12;
}
float subtractSixteen(float* number)
{
ptr_number=ptr_number-16;
}
float multiplyByEleven(float* number)
{
ptr_number=ptr_number*11;
}