Coding Bot: C|C++ Program Codes

Like Us On Facebook

Follow Us On Twitter


Sunday, 8 June 2014

Make Codes Postable - HTML Friendly


Make Codes Postable - HTML Friendly

So you're one of the developers who is tired of making is code HTML Friendly, changing '<' to '&lt;' and using '&amp;' in place of '&'. Making changes in a long code can be very much time consuming especially if you don't have time for this and want to this in fraction of a second.

Well if you're reading this, you've come to the right place and we're gonna do it for you - for FREE!! The following section will be very much useful for Web Developers. Basically what we do is, we make appropriate modifications in the code, replace x with y, a with b etc. All you have to do is paste your code in the following box and click on 'Make Friendly' button. You're modified code will appear in the same box. Now your code is ready copying and using it.




Friday, 6 June 2014

[SOLVED] Joomla -This email address is being protected from spambots. You need JavaScript enabled to view it.


This is one of the most common errors in Joomla. This email address is being protected from spambots. You need JavaScript enabled to view it. This usually occurs when you've included an email address in a Joomla article and you want to protect it  from Email harvesting spambots. 

You would've most probably used a built-in feature of joomla, i.e. enabled Content - Email Cloaking plugin, which basically does nothing but 'cloaks' the email address. It basically gives access to the email ID only to legitimate users who'll read and click on the message "This email address is being protected from spambots. You need JavaScript enabled to view it." so that it'll show the email in a separate window.



[SOLVED] Joomla -This email address is being protected from spambots. You need JavaScript enabled to view it.


After enabling the plugin, this error would be visible onto every page where you have displayed some email ID. However no need to panic. The solution is as simple as a click:


How to disable the email cloaking plug-in:

1.  Login into Admin Panel -> Extentions -> Plugin Manager

2. In the filter field, search for "Content - Email Cloaking". 

3. Under Status, tick on the 'green tick' to disable the plugin.

[SOLVED] Joomla -This email address is being protected from spambots. You need JavaScript enabled to view it.

4. Verify from below that you've successfully disabled the plugin.

[SOLVED] Joomla -This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Comment If You Liked The Post.


Tuesday, 19 November 2013

Calculate Roots Of a Quadratic Equation Using C Program


Hi everyone
In this post, we're going how to write a C program to calculate the roots of a quadratic equation. As we know that a quadratic equation is of a form like:

 ax^2+bx+c=0

So we won't go into much details. Also you guys must be knowing to calculate the roots of a quadratic equation directly, having formula:

Roots = ( -b + (b^2 - 4ac) ) / 2a ( -b - (b^2 - 4ac) ) / 2a

So we are just going to use the same formula in our C code. So Let's begin...

C Program To Calculate Roots Of a Quadratic Equation:

/* Double-Click To Select Code */

#include<stdio.h>
#include<conio.h>
#include<math.h>

void main()
{
float a,b,c,root1,root2,x,real,im;
clrscr();

printf("-> Quadratic Equation Form: ax2+bx+c");
printf("\n\nEnter the value of a: ");
scanf("%f",&a);
printf("\nEnter the value of b: ");
scanf("%f",&b);
printf("\nEnter the value of c: ");
scanf("%f",&c);

x = (b*b)-(4*a*c);

if(x>0)
{
root1 = (-b+sqrt(x))/(2*a);
root2 = (-b-sqrt(x))/(2*a);       //ROOTS ARE UNIQUE
printf("\nThe roots of the equation are: %.2f and %.2f",root1,root2);
}

else if(x==0)
{
root1 = -b/(2*a);
root2 = root1;  //ROOTS ARE SAME
printf("\nThe roots of the equation are: %.2f and %.2f",root1,root2);
}

else
{
real = -b/(2*a);
im = sqrt(-x)/(2*a);  // ROOTS ARE COMPLEX
printf("\nThe roots of the equation are: %.2f+j%.2f and %.2f-j%.2f",real,im,real,im);
}

getch();
}

Program Explanation:

The program is self explanatory in itself. First we take the coefficients of the quadratic equation as input from the user. Then on the basis of its determinant,i.e, b^2 - 4*a*c, if its greater than 0 or equal to 0 or less than 0. In each of the case, we can get different types of roots, Unique, Equal or Complex respectively. Using the formula as I described in the beginning of this post, we calculate roots, with an exception in case of complex roots, whereby, we have to find real and imaginary parts of the roots individually, using the formula:
Real Part = -b/(2*a)
Imaginary Part = sqrt(-x)/(2*a) -> Since determinant is negative here, we make it positive by multiplying an extra '-'.


Program Output:

C Program To Calculate Roots Of a Quadratic Equation

Please Comment If You Liked The Post.