Jump to content

Βοηθεια σε προγραμμα C


NetSurfer_g7
 Κοινοποίηση

Recommended Posts

Παίζει ρόλο πως τον ζητάς αυτό τον αριθμό.

Ας πούμε ότι τον αποθηκεύεις σε float και θέλεις να δεις αν είναι ακέραιος.

 

float f;
scanf ("%f\n", &f);
if (f == (int)f)	{
printf ("true\n");	
}
else	{
printf ("false\n");	
}

 

οπότε οι: 1, 2, 3.0, 15.00 θα δίνουν true

ενώ οι: 1.23, 2.3, κλπ θα δίνουν false

 

Αυτό ακριβώς ήθελα :thanks:

Android is simple, it just takes a genius to understand its simplicity.

Samsung Galaxy S4 die hard !!

Samsung Galaxy S7

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Επισκέπτης
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Κοινοποίηση

×
×
  • Create New...