• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
projectsgeek

ProjectsGeek

Download Mini projects with Source Code, Java projects with Source Codes

  • Home
  • Java Projects
  • C++ Projects
  • VB Projects
  • PHP projects
  • .Net Projects
  • NodeJs Projects
  • Android Projects
    • Project Ideas
      • Final Year Project Ideas
      • JSP Projects
  • Assignment Codes
    • Fundamentals of Programming Language
    • Software Design Laboratory
    • Data Structure and Files Lab
    • Computer Graphics Lab
    • Object Oriented Programming Lab
    • Assembly Codes
  • School Projects
  • Forum

Bitwise Operations using C++

September 7, 2011 by ProjectsGeek Leave a Comment

Bit-wise Operations using C++
#include
#include
#include void dectobi(int p)
{
int b,i,x,d;
for(i=31;i>=0;i--)
{
d=1<<i;
b=p&d;
if(b==0)
printf("0");
else
printf("1");
}
} 

void main()
{

int i,j,k,ch,n,m,a;
char cho;
clrscr();
do
{
printf("enter a integer\n");
scanf("%d",&n);
dectobi(n);
printf("\n 1 for 1`s compliment");
printf("\n 2 for AND opertion");
printf("\n 3 for OR opertion");
printf("\n 4 for EX-OR opertion");
printf("\n 5 for LEFT SHIFT opertion");
printf("\n 6 for RIGHT SHIFT opertion");
printf("\n 7 for EXIT\n");
scanf("%d",&ch);
switch(ch)
{
case 1:
printf(" \n1`s compliment\n");
a=~n;
dectobi(a);
break;
case 2:
printf("enter intger\n");
scanf("%d",&m);
dectobi(m);
printf("after and\n");
a=n&m;
dectobi(a);
break;
case 3:
printf("enter intger\n");
scanf("%d",&m);
dectobi(m);
printf("after OR\n");
a=n|m;
dectobi(a);
break;
case 4:
printf("enter intger\n");
scanf("%d",&m);
dectobi(m);
printf("after EX-OR\n");
a=n^m ;
dectobi(a);
break;
case 5:
printf("enter the no by u want to LEFT SHIFT");
scanf("%d",&m);
a=n<<m;
printf("after LEFT SHIFT\n");
a=n<<1;
        dectobi(a);
break;
case 6:
printf("enter the no by u want to RIGHT SHIFT");
scanf("%d",&m);
a=n>>m;
printf("after RIGHT SHIFT\n");
dectobi(a);
break;
case 7:
exit(0);
}
flushall();
printf("\nwant to continue (y/n)");
scanf("%c",&cho);
}
while(cho!='n');

}

Other Projects to Try:

  1. Operations on matrices like addition, multiplication, saddle point, magic square ,inverse & transpose
  2. Matrix Operations in C Language
  3. Set operations – Union, Intersection, Difference, Symmetric Difference using C
  4. How to Implement Hash Table using C language
  5. Sparse Matrix Operations Code using C Langauge

Filed Under: Computer Graphics Tagged With: Computer Graphics

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Tags

.Net Projects Download Android Project Ideas Android Projects Angular 2 Assembly Codes C # Projects C & C++ Projects C++ Projects Class Diagrams Computer Graphics Database Project Data Mining Projects DataScience Projects Datastructure Assignments Download Visual Basic Projects Electronics project Hadoop Projects Installation Guides Internet of Things Project IOS Projects Java Java Interview Questions Java Projects JavaScript JavaScript Projects java tutorial JSON JSP Projects Mechanical Projects Mongodb Networking Projects Node JS Projects OS Problems php Projects Placement Papers Project Ideas Python Projects seminar and presentation Struts

Search this Website


Footer

Download Java Project
Download Visual Basic Projects
Download .Net Projects
Download VB Projects
Download C++ Projects
Download NodeJs Projects
Download School Projects
Download School Projects
Ask Questions - Forum
Latest Projects Ideas
Assembly Codes
Datastructure Assignments
Computer Graphics Lab
Operating system Lab
australia-and-India-flag
  • Home
  • About me
  • Contact Form
  • Submit Your Work
  • Site Map
  • Privacy Policy