#include<iostream.h>
#include<conio.h>
class s{
int n;
public:
void getvalues();
void evodd();
void prime();
};
void s::getvalues()
{
cout<<"Enter a number greater than 1:";
cin>>n;
}
void s::evodd()
{
if(n%2==0)
cout<<"The number is even and ";
else
cout<<"The number is odd and ";
}
void s::prime()
{
int flag=0;
for(int i=2;i<n;i++)
{
if(n%i==0)
{
flag=1;
break;
}
}
if(flag==1)
cout<<"it is not a prime number.";
else
cout<<"it is a prime number.";
getch();
}
void main()
{
clrscr();
s ob;
char c;
do{
clrscr();
ob.getvalues();
ob.evodd();
ob.prime();
cout<<"\nDo you wish to continue? (Y/N) :";
cin>>c;
}while(c=='y'||c=='Y');
getch();
}
Sunday, January 18, 2015
To check a number is even or odd or prime
Install MySQL essential 5.0.67 and MySQL Query Analyzer
Download 'mysql-essential-5.0.67-win32'
Download 'MySQL Query Analyzer 57'
- Open mysql-essential-5.0.67-win32
- Next
- Complete
- Next
- Install
- Next
- Next
- Finish
- Next
- Standard Configuration
- Next
- Next
- Enter any password for root
- Retype the same password below
- Next
- Execute
- Finish
- Click to install the second setup - MySQL_Query_Analyzer_57
- Next
- Next
- tick Create a desktop icon
- Next
- Install
- Finish On the new window
- Server - localhost
- User name - root
- Password - password you given before
- tick save password
Install MySQL on windows8
1. Download MySQL from http://dev.mysql.com/downloads/mysql/
2. Download this tutorial to install MySQL on your Windows 8 pc.
2. Download this tutorial to install MySQL on your Windows 8 pc.
Find sum of digits of a number using c++
#include<iostream.h>
#include<conio.h>
class s_digits{
int num,sum;
public:
void input();
void calculate();
void output();
};
void s_digits::input()
{
cout<<"Enter your number:";
cin>>num;
}
void s_digits::calculate()
{
sum=0;
int r,n;
n=num;
while(n>0)
{
r=n%10;
sum+=r;
n=n/10;
}
}
void s_digits::output()
{
cout<<"The number entered is:"<<num;
cout<<"\nSum of its digits is:"<<sum;
}
void main()
{ clrscr();
s_digits ob;
ob.input();
ob.calculate();
ob.output();
getch();
}
Sunday, January 4, 2015
Adding syntax highlighter to Blogger
For safety precautions click Template>Backup/Restore>Download Full Template for download full html code of your present blog's template.
Select "Edit HTML" option to see the full html code in the editor. Now we are going to add some codes into our blogger template code.
STEP 1
Go to http://syntaxhighlighter.googlecode.com/svn/trunk/Styles/SyntaxHighlighter.css, and perform "select all" and "copy" the whole code and paste it at the end of the css section of your blogger html template (i.e., before ]]></b:skin>). (Press Ctrl+F then type and search </b:skin> to locate it easily)
STEP 2
Before the </head> tag, paste the following code:
<!-- Add-in CSS for syntax highlighting --> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shCore.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushCpp.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushCSharp.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushCss.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushDelphi.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushJava.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushJScript.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushPhp.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushPython.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushRuby.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushSql.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushVb.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushXml.js' type='text/javascript'></script>
(Simply remove lines for languages which you will never use (for example, Delphi) -- it will save some loading time of the blogs.)
STEP 3
Before the </body> tag, insert the following:
<!-- Add-in Script for syntax highlighting --> <script language='javascript'> dp.SyntaxHighlighter.BloggerMode(); dp.SyntaxHighlighter.HighlightAll('code'); </script>
(Tweaking of the Blogger HTML template code is complete. So before you save the template code just click on "Preview" button to see if the code is not crashing & working fine.)
STEP 4
While posting a post that has source code then click on "Edit Html" tab and post the source code between pre tags shown below
<pre name="code" class="cpp">
...Your html-escaped code goes here...
</pre>
In the above code substitute "cpp" with whatever language you're using. Choices: cpp, c, c++, c#, c-sharp, csharp, css, delphi, pascal, java, js, jscript, javascript, php, py, python, rb, ruby, rails, ror, sql, vb, vb.net, xml, html, xhtml, xslt. Full list can be accessed at Supported languages.
NOTE: Instead of remembering the code everytime we can add this HTML code simply into the template so that it is displayed whenever we create a new post. Click on "Settings" tab and then "formatting" sub-tab and post the html code in the "Post Template" box. As a result next whenever we create a new post it is displayed when we click "Edit Html".
We have to perform HTML escaping which can be done in the sites like Centricle, Accessify.
Reference
[1] Heisencoder - Link
Select "Edit HTML" option to see the full html code in the editor. Now we are going to add some codes into our blogger template code.
STEP 1
Go to http://syntaxhighlighter.googlecode.com/svn/trunk/Styles/SyntaxHighlighter.css, and perform "select all" and "copy" the whole code and paste it at the end of the css section of your blogger html template (i.e., before ]]></b:skin>). (Press Ctrl+F then type and search </b:skin> to locate it easily)
STEP 2
Before the </head> tag, paste the following code:
<!-- Add-in CSS for syntax highlighting --> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shCore.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushCpp.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushCSharp.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushCss.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushDelphi.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushJava.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushJScript.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushPhp.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushPython.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushRuby.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushSql.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushVb.js' type='text/javascript'></script> <script src='http://syntaxhighlighter.googlecode.com/svn/trunk/Scripts/shBrushXml.js' type='text/javascript'></script>
(Simply remove lines for languages which you will never use (for example, Delphi) -- it will save some loading time of the blogs.)
STEP 3
Before the </body> tag, insert the following:
<!-- Add-in Script for syntax highlighting --> <script language='javascript'> dp.SyntaxHighlighter.BloggerMode(); dp.SyntaxHighlighter.HighlightAll('code'); </script>
(Tweaking of the Blogger HTML template code is complete. So before you save the template code just click on "Preview" button to see if the code is not crashing & working fine.)
STEP 4
While posting a post that has source code then click on "Edit Html" tab and post the source code between pre tags shown below
<pre name="code" class="cpp">
...Your html-escaped code goes here...
</pre>
In the above code substitute "cpp" with whatever language you're using. Choices: cpp, c, c++, c#, c-sharp, csharp, css, delphi, pascal, java, js, jscript, javascript, php, py, python, rb, ruby, rails, ror, sql, vb, vb.net, xml, html, xhtml, xslt. Full list can be accessed at Supported languages.
NOTE: Instead of remembering the code everytime we can add this HTML code simply into the template so that it is displayed whenever we create a new post. Click on "Settings" tab and then "formatting" sub-tab and post the html code in the "Post Template" box. As a result next whenever we create a new post it is displayed when we click "Edit Html".
We have to perform HTML escaping which can be done in the sites like Centricle, Accessify.
Reference
[1] Heisencoder - Link
Subscribe to:
Comments (Atom)
