Deprecated: Optional parameter $i declared before required parameter $data is implicitly treated as a required parameter in /home4/aipsa9vw/public_html/blogs/wp-content/themes/voice/include/modules.php on line 4

Deprecated: Optional parameter $i declared before required parameter $data is implicitly treated as a required parameter in /home4/aipsa9vw/public_html/blogs/wp-content/themes/voice/include/modules.php on line 245

Deprecated: Optional parameter $output declared before required parameter $attr is implicitly treated as a required parameter in /home4/aipsa9vw/public_html/blogs/wp-content/themes/voice/include/snippets.php on line 431

Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /home4/aipsa9vw/public_html/blogs/wp-content/themes/voice/include/mega-menu.php on line 147

Warning: Cannot modify header information - headers already sent by (output started at /home4/aipsa9vw/public_html/blogs/wp-content/themes/voice/include/modules.php:4) in /home4/aipsa9vw/public_html/blogs/wp-includes/rest-api/class-wp-rest-server.php on line 1909

Warning: Cannot modify header information - headers already sent by (output started at /home4/aipsa9vw/public_html/blogs/wp-content/themes/voice/include/modules.php:4) in /home4/aipsa9vw/public_html/blogs/wp-includes/rest-api/class-wp-rest-server.php on line 1909

Warning: Cannot modify header information - headers already sent by (output started at /home4/aipsa9vw/public_html/blogs/wp-content/themes/voice/include/modules.php:4) in /home4/aipsa9vw/public_html/blogs/wp-includes/rest-api/class-wp-rest-server.php on line 1909

Warning: Cannot modify header information - headers already sent by (output started at /home4/aipsa9vw/public_html/blogs/wp-content/themes/voice/include/modules.php:4) in /home4/aipsa9vw/public_html/blogs/wp-includes/rest-api/class-wp-rest-server.php on line 1909

Warning: Cannot modify header information - headers already sent by (output started at /home4/aipsa9vw/public_html/blogs/wp-content/themes/voice/include/modules.php:4) in /home4/aipsa9vw/public_html/blogs/wp-includes/rest-api/class-wp-rest-server.php on line 1909

Warning: Cannot modify header information - headers already sent by (output started at /home4/aipsa9vw/public_html/blogs/wp-content/themes/voice/include/modules.php:4) in /home4/aipsa9vw/public_html/blogs/wp-includes/rest-api/class-wp-rest-server.php on line 1909

Warning: Cannot modify header information - headers already sent by (output started at /home4/aipsa9vw/public_html/blogs/wp-content/themes/voice/include/modules.php:4) in /home4/aipsa9vw/public_html/blogs/wp-includes/rest-api/class-wp-rest-server.php on line 1909

Warning: Cannot modify header information - headers already sent by (output started at /home4/aipsa9vw/public_html/blogs/wp-content/themes/voice/include/modules.php:4) in /home4/aipsa9vw/public_html/blogs/wp-includes/rest-api/class-wp-rest-server.php on line 1909
{"id":344,"date":"2023-01-19T13:55:00","date_gmt":"2023-01-19T13:55:00","guid":{"rendered":"https:\/\/aipsacademy.com\/blogs\/?p=344"},"modified":"2023-07-17T04:12:23","modified_gmt":"2023-07-17T04:12:23","slug":"jump-statements-in-c-with-best-example","status":"publish","type":"post","link":"https:\/\/aipsacademy.com\/blogs\/2023\/01\/19\/jump-statements-in-c-with-best-example\/","title":{"rendered":"Jump statements in C++ with best example"},"content":{"rendered":"\n

Jump statements <\/a>are used to transfer the control <\/a>form one part of the program<\/a> to another part.<\/strong><\/p>\n\n\n\n

\n

There are three jump statement<\/a>s in C++ programming language<\/a>.<\/p>\n\n\n\n

  1. break statement<\/li>
  2. continue statement<\/li>
  3. goto statement<\/li><\/ol>\n\n\n\n

    Break Statement in C++ <\/h4>\n<\/div><\/div>\n\n\n\n

    This statement is used for two purpose.<\/p>\n\n\n\n

    1. To terminate loop<\/a> permanently<\/li>
    2. To exit from switch case<\/a><\/li><\/ol>\n\n\n\n

      Q. write a program to represent break statement.<\/p><\/blockquote>\n\n\n\n

      #include<iostream.h>\n#include<conio.h>\nvoid main()  \n{\nclrscr();\nint i;\nfor(i=1; i<=10; i++)\n{\nif(i==5)\nbreak;\ncout<<\u201d\\n AIPS ACADEMY\u201d;\n}\ngetch();\n}\n<\/code><\/pre>\n\n\n\n

      Output<\/p>\n\n\n\n

      \n
      \n

      AIPS ACADEMY<\/p>\n\n\n\n

      AIPS ACADEMY<\/p>\n\n\n\n

      AIPS ACADEMY<\/p>\n\n\n\n

      AIPS ACADEMY<\/p>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n

      OR<\/p><\/blockquote>\n\n\n\n

      #include<iostream.h>\n#include<conio.h>\nvoid main()  \n{\nclrscr();\nint i;\nfor(i=1; i<=10; i++)\n{\ncout<<\u201d\\n AIPS ACADEMY\u201d;\n\nif(i==5)\nbreak;\n}\ngetch();\n}\n<\/code><\/pre>\n\n\n\n

      Output<\/p>\n\n\n\n

      \n

      AIPS ACADEMY<\/p>\n\n\n\n

      AIPS ACADEMY<\/p>\n\n\n\n

      AIPS ACADEMY<\/p>\n\n\n\n

      AIPS ACADEMY<\/p>\n\n\n\n

      AIPS ACADEMY<\/p>\n<\/div><\/div>\n\n\n\n

      Find Output<\/p><\/blockquote>\n\n\n\n

      #include<iostream.h>\n#include<conio.h>\nvoid main()  \n{\nclrscr();\nint i;\nfor(i=1; i<=10; i++)\n{\n\nif(i==5)\nbreak;\ncout<<\u201d\\n\u201d<<i;\n\n}\ngetch();\n}\n<\/code><\/pre>\n\n\n\n

      output<\/p>\n\n\n\n

      \n

      1<\/p>\n\n\n\n

      2<\/p>\n\n\n\n

      3<\/p>\n\n\n\n

      4<\/p>\n<\/div><\/div>\n\n\n\n

      Find Output<\/p><\/blockquote>\n\n\n\n

      #include<iostream.h>\n#include<conio.h>\nvoid main()  \n{\nclrscr();\nint i;\nfor(i=1; i<=10; i++)\n{\ncout<<\u201d\\n\u201d<<i;\n\nif(i==5)\nbreak;\n\n}\ngetch();\n}\n<\/code><\/pre>\n\n\n\n

      Output<\/p>\n\n\n\n

      1<\/p>\n\n\n\n

      2<\/p>\n\n\n\n

      3<\/p>\n\n\n\n

      4<\/p>\n\n\n\n

      5<\/p>\n\n\n\n

      Continue Statement in C++<\/h4>\n\n\n\n

      It is used to skip one execution of loop.<\/p>\n\n\n\n

      Q. write a program to represent continue statement.<\/p><\/blockquote>\n\n\n\n

      #include<iostream.h>\n#include<conio.h>\nvoid main()  \n{\nclrscr();\nint i;\nfor(i=1; i<=5; i++)\n{\n\nif(i==3)\ncontinue;\ncout<<\u201d\\n\u201d<<i;\n\n}\ngetch();\n}\n<\/code><\/pre>\n\n\n\n

      Output<\/p>\n\n\n\n

      \n

      1<\/p>\n\n\n\n

      2<\/p>\n\n\n\n

      4<\/p>\n\n\n\n

      5<\/p>\n<\/div><\/div>\n\n\n\n

      Find output<\/p><\/blockquote>\n\n\n\n

      #include<iostream.h>\n#include<conio.h>\nvoid main()  \n{\nclrscr();\nint i;\nfor(i=1; i<=5; i++)\n{\ncout<<\u201d\\n\u201d<<i;\n\nif(i==3)\ncontinue;\n\n}\ngetch();\n}<\/code><\/pre>\n\n\n\n

      Output<\/p>\n\n\n\n

      \n

      1<\/p>\n\n\n\n

      2<\/p>\n\n\n\n

      3<\/p>\n\n\n\n

      4<\/p>\n\n\n\n

      5<\/p>\n<\/div><\/div>\n\n\n\n

      Goto Statement in C++<\/h4>\n\n\n\n

      It is used to transfer the control from one part of the program to another part.<\/p>\n\n\n\n

      It can also be used for repeat some statements.<\/p>\n\n\n\n

      syntax<\/p>\n\n\n\n

      goto label;<\/p>\n\n\n\n

      Q. Write a program to print your name five times using goto statement.<\/p><\/blockquote>\n\n\n\n

      #include<iostream.h>\n#include<conio.h>\nvoid main()  \n{\nclrscr();\nint i;\ni=1;\naips:\ncout<<\u201d\\n AIPS ACADEMY\u201d;\ni++;\nif(i<=5)\ngoto aips;\n\ngetch();\n}\n<\/code><\/pre>\n\n\n\n

      Output<\/p>\n\n\n\n

      \n

      AIPS ACADEMY<\/p>\n\n\n\n

      AIPS ACADEMY<\/p>\n\n\n\n

      AIPS ACADEMY<\/p>\n\n\n\n

      AIPS ACADEMY<\/p>\n\n\n\n

      AIPS ACADEMY<\/p>\n<\/div><\/div>\n\n\n\n

      Q. Write a program to print numbers from 1 to 5 using goto statement.<\/p><\/blockquote>\n\n\n\n

      #include<iostream.h>\n#include<conio.h>\nvoid main()  \n{\nclrscr();\nint i;\ni=1;\naips:\ncout<<\u201d\\n\u201d<<i;\ni++;\nif(i<=5)\ngoto aips;\n\ngetch();\n}<\/code><\/pre>\n\n\n\n

      Output<\/p>\n\n\n\n

      \n

      1<\/p>\n\n\n\n

      2<\/p>\n\n\n\n

      3<\/p>\n\n\n\n

      4<\/p>\n\n\n\n

      5<\/p>\n<\/div><\/div>\n\n\n\n

      <\/p>\n\n\n\n

      Also Read: Loop in C++<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"

      Jump statements are used to transfer the control form one part of the program to another part. There are three jump statements in C++ programming language. break statement continue statement goto statement Break Statement in C++ This statement is used for two purpose. To terminate loop permanently To exit from switch case Q. write a […]<\/p>\n","protected":false},"author":1,"featured_media":345,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5,7,6,8],"tags":[],"class_list":["post-344","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-11th-computer-science","category-12th-computer-science","category-cbse","category-jac","category-jac-12th-computer-science"],"_links":{"self":[{"href":"https:\/\/aipsacademy.com\/blogs\/wp-json\/wp\/v2\/posts\/344","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aipsacademy.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aipsacademy.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aipsacademy.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aipsacademy.com\/blogs\/wp-json\/wp\/v2\/comments?post=344"}],"version-history":[{"count":6,"href":"https:\/\/aipsacademy.com\/blogs\/wp-json\/wp\/v2\/posts\/344\/revisions"}],"predecessor-version":[{"id":584,"href":"https:\/\/aipsacademy.com\/blogs\/wp-json\/wp\/v2\/posts\/344\/revisions\/584"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aipsacademy.com\/blogs\/wp-json\/wp\/v2\/media\/345"}],"wp:attachment":[{"href":"https:\/\/aipsacademy.com\/blogs\/wp-json\/wp\/v2\/media?parent=344"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aipsacademy.com\/blogs\/wp-json\/wp\/v2\/categories?post=344"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aipsacademy.com\/blogs\/wp-json\/wp\/v2\/tags?post=344"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}