简体   繁体   中英

Dev-C++: 'prinft' undeclared

I´m completely new to programming and just started some tutorials from the internet. One of them suggested this code for an easy question for the user:

#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int input;

printf("Please enter a number between 1 and 4:\n");
scanf("%d",&input);
fflush(stdin);

switch(input)
{
case 1: prinft("You entered 1\n");
break;
case 2: prinft("You entered 2\n");
break;
case 3: printf("You entered 3\n");
break;
case 4: printf("You entered 4\n");
break;
default: printf("Unknown Input, please try again\n");
}

system("PAUSE");
return 0;
}

I use Dev-C++ and can´t even compile the code. the "case 1:"-row gets highlighted and the error-message says: 'printf' undeclared (first use this function). Can anybody tell me how to fix this problem?

Typo:

prinft()

should be:

printf()

printf is short for "print formatted".

Small mistakes in your code can confuse you, but you got to be persistent. This community, is generally harsh to beginners. Anyway, best of wishes in you programming adventures.

prinft(); 

should actually be

printf();

Some advice: you can change int main(int argc, char *argv[]) to

int main(int a, char *b[]) and whatever else you want. You don't have to confuse yourself.

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