Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with visual c++ program

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Please, I need some help badly. I had to write a program for school that contains the Beaufort Scale ( a scale that measures wind velocity in knots). It prompts the urder to enter a velocity and then returns a message depending on that value. I have written the code, but I can't compile because I keep getting " unknown identifier" on printf and scanf. I have sat here for two days and I just cant figure this out. Please help. Thanks in advance. here is my source code:

// Beaufort scale.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"


int main(int argc, char* argv[])
{
int velocity;

printf(" Enter wind velocity ( in knots ): ");
scanf("%d", &velocity);

switch (velocity) {
case 0:
printf (" The wind is calm"); break;
case 1: case 2: case 3:
printf ("The wind is light"); break;
case 4: case 5: case 6: case 7: case 8:
case 9: case 10: case 11: case 12: case 13:
case 14: case 15: case 16: case 17: case 18:
case 19: case 20: case 21: case 22: case 23:
case 24: case 25: case 26: case 27:
printf (" The wind is breezy"); break;
case 28: case 29: case 30: case 31: case 32:
case 33: case 34: case 35: case 36: case 37:
case 38: case 39: case 40: case 41: case 42:
case 43: case 44: case 45: case 46: case 47:
printf (" There is a gale"); break;
case 48: case 49: case 50: case 51: case 52:
case 53: case 54: case 55: case 56: case 57:
case 58: case 59: case 60: case 61: case 62:
case 63:
printf (" There is a storm"); break;
default: printf (" There is a hurricane"); break;
}



return 0;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top