Thread: what exactly does this "for" do?

  1. #1
    Registered User
    Join Date
    Oct 2019
    Posts
    7

    what exactly does this "for" do?

    hello everyone, a little help with what exactly does this "for"?

    for (int i=1; i <=sets; i++) {
    printf("%d\n", i);
    scanf("%d.%d.%d.%d", &a, &b, &c, &d);

    MSK_1 = (a << 24)+(b << 16)+(c << 8)+d;


    scanf("%u", &MSK_2);
    scanf("%d.%d.%d.%d", &a, &b, &c, &d);
    IP_1 = (a << 24)+(b << 16)+(c << 8)+d;


    scanf("%d.%d.%d.%d", &a, &b, &c, &d);
    IP_2 = (a << 24)+(b << 16)+(c << 8)+d;

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    27,506
    Write a program that incorporates this loop. Enter an IPv4 address in dotted format. It'll soon become obvious what this does.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 12-08-2014, 08:12 PM
  2. Replies: 5
    Last Post: 10-12-2012, 06:17 AM
  3. Replies: 2
    Last Post: 08-19-2012, 06:15 AM
  4. "itoa"-"_itoa" , "inp"-"_inp", Why some functions have "
    By L.O.K. in forum Windows Programming
    Replies: 5
    Last Post: 12-08-2002, 08:25 AM
  5. "CWnd"-"HWnd","CBitmap"-"HBitmap"...., What is mean by "
    By L.O.K. in forum Windows Programming
    Replies: 2
    Last Post: 12-04-2002, 07:59 AM

Tags for this Thread