Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_pre.php on line 387

Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_pre.php on line 387

Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_seo.php on line 337

Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_seo.php on line 339

Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_seo.php on line 341

Warning: Non-static method vBSEO_Storage::path() should not be called statically in ..../vbseo/includes/functions_vbseo_seo.php on line 343
printf and scanf

Results 1 to 3 of 3
  1. #1
    Senior Member
    Join Date
    May 2007
    Posts
    104

    printf and scanf

    How to use these commands because I heard that it is easier to use than cout + cin !??! I'd like to have some examples how to use them.

  2. #2
    Coders muppetalert's Avatar
    Join Date
    Nov 2007
    Location
    Manchester, UK
    Posts
    1,005

    Re: printf and scanf

    Code:
    printf("whatever"); // Output
    char blah[100];
    scanf("%s", blah); // (Formatted) Input
    whiteLight: ET, whiteLight: Quake Live (Formerly QLHook) and many other game hacks at http://whitelight.me.uk/

  3. #3
    Member bbq-'s Avatar
    Join Date
    Apr 2008
    Posts
    67

    Re: printf and scanf

    Google is your friend in this case as there is a plethora of examples, anyway this is just a small example in java of how printf can be used

    Code:
    class PrintfDemo
    {
       public static void main(String[] args)
       {
            //our variables
            double x = 1; 
            double y = 3;
            double z = x / y;	//would be 0.333->till memory for double is used up
       	   	
            //printf using 2 decimal place modifier.
            System.out.printf("%.2f", z);
       }
    
    }
    This would print 0.33 so it can be used to manipulate what the user views etc... hope it helps a bit

    Somewhere to read up on it, printf - C++ Reference

    have fun

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •