Ronak Agrawal's blog

C++:Reverse a number

Upon request, i am posting a small program which would reverse a number.For an example we have:

Input 12345
Output 54321

Note:Please use long as data type else this program will no work for digits greater than four.

Here goes the program.

#include<iostream.h>
 
void main()
{
       cout<<"\t\t||Jai Saraswati||\n\n";
 
       long num,rem,newn=0;
       cout<<"Enter the Number:\t";
       cin>>num;

C++:Simple program to calculate total and percentage

The following program would do the following:

  1. Input Roll No
  2. Input Marks obtained for three subjects
  3. Calculate Total
  4. Calculate Percentage

#include<iostream.h>
#include<conio.h>
 
void main()
{
 
        int roll,eng,sci,maths;
        float total=0;              //initializing->total=0;
        float percent;              //float->data type
 
        cout<<"Roll:\t";            //"\t"->Horizontal Tab
        cin>>roll;
 
        cout<<"\nEnglish:\t";
        cin>>eng;
 
        cout<<"Science:\t";
        cin>>sci;
 
        cout<<"Mathematics:\t";
        cin>>maths;
 
        cout<<endl<<"Total:\t";          //endl or "\n"->Break line
        total=eng+sci+maths;           
        cout<<total;
 
        cout<<"\nPercent:\t";
        percent=(total/300)*100;
        cout<<percent<<"%";
 
        getch();
}

Using If Condition in C++

If condition is used to compare two or more string.
The following program checks whether a given number is even or odd.

It works with Modulus Operator followed by if condition.

*Firstly, the modulus operator(%) gives the remainder.
*Secondly the if_condition checks whether the remainder is zero or not.
*If it is zero than it is even else odd..

#include<iostream.h>
#include<conio.h>
 
void main()
{
        int n;
        cout<<"Input No:\t";
        cin>>n;
        
 
        if(n%2==0)
        cout<<"\nThe no is even";
 
        else 
        cout<<"\nThe no is odd";

C++:Use the Modulus(%) Operator to get reminder

Use the Modulus(%) Operator to get reminder

#include<iostream.h>            //Header File for console input and output
#include<conio.h>                      //Header File for getch()
        
void main()
{       
        int a,b;                
        a=5;                                         //Initializing the value.
        b=2;                                         //Use Cin>> to input via Keyboard.

Distinguish between FLOAT and INTEGER

This following code will help the programer to distinguish between the two numeric data-type FLOAT AND INTEGER.

#include<iostream.h>            //Header File for console input and output
#include<conio.h>               //Header File for getch(),clrscr();
        
void main()
{
        clrscr();               //Clears Screen
                        
        int a;
        float b;

C++:A simple program to add two numbers

Here is a simple program to do addition in c++

#include<iostream.h> //Header File
#include<conio.h>     //Header File->For Clearing Screen in Turbo C++
 
int main()
{
       clrscr();
       int a,b;
       int sum=0;
       cout<<"Enter a:";
       cin>>a;

Getting Started with C++

Friends,

For a computer lover, programing language is not only a precious stone but in fact it is a tool which helps the user to increase his logical and reasoning power.It is only bcoz of programing language people have done remarkable job in the history of computers..

Thereby i feel, to increase the curiosity of teenagers and newbies towards programing language i will be posting short programing codes on C++ (Turbo 3)

Download Win7-Win Vista themes for Windows XP!!

Tags:

Guys,

If you are still using Windows XP but want to enjoy the look of Windows Vista or Windows 7, then download the following themes:

Customize the look of the Websites

Description

Stylish is a Firefox, Thunderbird, Flock, SeaMonkey, Mozilla Suite, and Songbird extension that allows easy management of user styles. User styles empower your browsing experience by letting you fix ugly sites, customize the look of your browser or mail client, or just have fun.

With an online repository at userstyles.org, you don't even need to know how to write styles yourself; just a couple clicks and the chosen style is applied. Stylish is to CSS what Greasemonkey is to JavaScript, and unlike other methods of using user styles, most styles take effect immediately.

Windows7 Upgrade Plan

Tags:

Although Microsoft is not revealing that many information about its Windows 7 upgrade plans some information have come to light.

Syndicate content