Example
#{example}"); ipb.editor_values.get('templates')['togglesource'] = new Template(""); ipb.editor_values.get('templates')['toolbar'] = new Template(""); ipb.editor_values.get('templates')['button'] = new Template("
Emoticons
"); // Add smilies into the mix ipb.editor_values.set( 'show_emoticon_link', false ); ipb.editor_values.set( 'bbcodes', $H({"snapback":{"id":"1","title":"Post Snap Back","desc":"This tag displays a little linked image which links back to a post - used when quoting posts from the board. Opens in same window by default.","tag":"snapback","useoption":"0","example":"[snapback]100[/snapback]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"topic":{"id":"5","title":"Topic Link","desc":"This tag provides an easy way to link to a topic","tag":"topic","useoption":"1","example":"[topic=1]Click me![/topic]","switch_option":"0","menu_option_text":"Enter the topic ID","menu_content_text":"Enter the title for this link","single_tag":"0","optional_option":"0","image":""},"post":{"id":"6","title":"Post Link","desc":"This tag provides an easy way to link to a post.","tag":"post","useoption":"1","example":"[post=1]Click me![/post]","switch_option":"0","menu_option_text":"Enter the Post ID","menu_content_text":"Enter the title for this link","single_tag":"0","optional_option":"0","image":""},"spoiler":{"id":"7","title":"Spoiler","desc":"Spoiler tag","tag":"spoiler","useoption":"0","example":"[spoiler]Some hidden text[/spoiler]","switch_option":"0","menu_option_text":"","menu_content_text":"Enter the text to be masked","single_tag":"0","optional_option":"0","image":""},"acronym":{"id":"8","title":"Acronym","desc":"Allows you to make an acronym that will display a description when moused over","tag":"acronym","useoption":"1","example":"[acronym='Laugh Out Loud']lol[/acronym]","switch_option":"0","menu_option_text":"Enter the description for this acronym (EG: Laugh Out Loud)","menu_content_text":"Enter the acronym (EG: lol)","single_tag":"0","optional_option":"0","image":""},"hr":{"id":"12","title":"Horizontal Rule","desc":"Adds a horizontal rule to separate text","tag":"hr","useoption":"0","example":"[hr]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"1","optional_option":"0","image":""},"php":{"id":"14","title":"PHP Code","desc":"Allows you to enter PHP code into a formatted/highlighted syntax box","tag":"php","useoption":"0","example":"[php]$variable = true;\n\nprint_r($variable);[/php]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"html":{"id":"15","title":"HTML Code","desc":"Allows you to enter formatted/syntax-highlighted HTML code","tag":"html","useoption":"0","example":"[html]\n \n[/html]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"sql":{"id":"16","title":"SQL Code","desc":"Allows you to enter formatted/syntax-highlighted SQL code","tag":"sql","useoption":"0","example":"[sql]SELECT p.*, t.* FROM posts p LEFT JOIN topics t ON t.tid=p.topic_id WHERE t.tid=7[/sql]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"xml":{"id":"17","title":"XML Code","desc":"Allows you to enter formatted/syntax-highlighted XML code","tag":"xml","useoption":"0","example":"[xml]1 Replies - 18 Views - Last Post: Today, 01:08 PM
#1
Reputation: 0
- Posts: 15
- Joined: 27-March 13
Posted Today, 12:18 PM
Okay. Was gone there for a bit, but I'm back to the drawing board!I am writing a program that checks for the inserted number's primeness.
If the number is prime, then it should echo, else, it should echo that it isn't.
If the number is prime, then it just skips to the end, without echoing.
If the number is not prime, it also just skips ahead, without echoing.
If the number is not prime, whilst being divisible by 3, then it spams that the number is prime.
I added a break, yet saw no desired results.
Without further ado, I give thee my code:
#include "stdafx.h" #include <iostream> #include <cmath> using namespace std; int main() { int i, n; int is_prime = true; cout << "Enter a number to be tested for Optimus: \n"; cin >> n; i = 2; while (i <= sqrt((double)n)) { if (n % i == 0) { is_prime = false; i++; } if (is_prime) cout << "Your number is Optimus. Recieve 500 souls.\n"; else cout << "Your number is not Optimus. Devour your lift pinky, but remember to do this only by wrapping the little piggie into a blanket and pouring insanely hot gravy onto it and sucking it clean. Then mash the bone down into a powder and snort it. Enjoy, and thankyou for visiting Casa De Blanca!\n"; } system("PAUSE"); return 0; }
Going to work in about 90 minutes, or so. Hoping to continue this endeavor at a later hour(if not possibly before work).
Is This A Good Question/Topic? 0
Replies To: Prime number checker w/loop error & failed cout
#2
Reputation: 2472
- Posts: 8,463
- Joined: 08-August 08
Re: Prime number checker w/loop error & failed cout
Posted Today, 01:08 PM
- If the number is shown to be not prime then why do you continue with the while loop?
- If the number has not yet been shown to be prime or not prime (still in the loop) then why do you output that it is or is not prime?
Page 1 of 1
Source: http://www.dreamincode.net/forums/topic/319002-prime-number-checker-wloop-error-failed-cout/
legend of korra magic mike trailer Alan Turing brave Stephanie Rice Meet the Pyro Karen Klein
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন