C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 19th, 2012, 05:17 AM
Hunain Hafeez Hunain Hafeez is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 2 Hunain Hafeez User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 26 m 35 sec
Reputation Power: 0
Ounter of 6 bit and i need a counter of 48 bit

this code is working for a counter of 6 bit and i need a counter of 48 bit ... if u have time kindly try it..... i try alot but not succeed

#include<stdio.h>
#include<stdlib.h>
#include<float.h>
#include<math.h>
#include <time.h>
#include <cstdlib>
#include <iostream>
#include<stdint.h>
#include<conio.h>

int main()
{

int a[64][6];
int i,j,k,d,c,n;
for(k=0;k<64;k++) //6 digit binary so 2^6 =64 is no: of combinations
{
for(j=0;j<6;j++)
{
a[k][j]=0;
}
}
for(i=0;i<64;i++)
{
n=i;
for(j=5;j>=0;j--)
{
while(n!=0)
{
a[i][j]=n%2;
j--;
n=n/2;
}
}
}
for(k=0;k<64;k++)
{
for(j=0;j<6;j++)
{
printf("%d",a[k][j]);
}
printf(" .................%d\n",k);
}
//printf("\n **** KHATAM SHo ****\n");
getch();
return 0;

}

Reply With Quote
  #2  
Old October 19th, 2012, 05:30 AM
salem's Avatar
salem salem is offline
Contributed User
Click here for more information
 
Join Date: Jun 2005
Posts: 3,835 salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 153 Folding Title: Novice Folder
Time spent in forums: 2 Months 3 Weeks 2 Days 16 h 3 m 48 sec
Reputation Power: 1774
Edit your post, and put [code][/code] tags around the code.

It should look like this when you're done.
Code:
#include <stdio.h>
int main ( ) {
    // code code code
    return 0;
}
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper

Reply With Quote
  #3  
Old October 19th, 2012, 06:12 AM
Hunain Hafeez Hunain Hafeez is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 2 Hunain Hafeez User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 26 m 35 sec
Reputation Power: 0
Code:

#include<stdio.h>
#include<stdlib.h>
#include<float.h>
#include<math.h>
#include <time.h>
#include <cstdlib>
#include <iostream>
#include<stdint.h>
#include<conio.h>

int main()
{

 int a[64][6];
 int  i,j,k,d,c,n;
for(k=0;k<64;k++) //6 digit binary so 2^6 =64 is no: of combinations 
{
    for(j=0;j<6;j++)
    {
        a[k][j]=0;
    }
}
for(i=0;i<64;i++)
{
    n=i;
    for(j=5;j>=0;j--)
    {
        while(n!=0)
        {
            a[i][j]=n%2;
            j--;    
            n=n/2;      
        }
    }
}
for(k=0;k<64;k++)
{
    for(j=0;j<6;j++)
    {
        printf("%d",a[k][j]);
    }
    printf(" .................%d\n",k);
}
//printf("\n **** KHATAM SHo ****\n");
    getch();
    return 0;
    
}





Reply With Quote
  #4  
Old October 19th, 2012, 07:33 AM
salem's Avatar
salem salem is offline
Contributed User
Click here for more information
 
Join Date: Jun 2005
Posts: 3,835 salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 153 Folding Title: Novice Folder
Time spent in forums: 2 Months 3 Weeks 2 Days 16 h 3 m 48 sec
Reputation Power: 1774
Quote:
#include<stdio.h>
#include<stdlib.h>
#include<float.h>
#include<math.h>
#include <time.h>
#include <cstdlib>
#include <iostream>
#include<stdint.h>
#include<conio.h>

First, decide whether you're writing C or C++.
Including a whole mess of header files from all over the place doesn't help.

> int a[64][6];
> int i,j,k,d,c,n;
Pick meaningful variable names.
Aside from i,j for loop variables, everything else should have a more descriptive name.

Also, how does 64 and 6 relate to your requirement for 48 bits?

Which compiler are you using?
I note from your use of <iostream> that it seems to be something reasonably modern.

Perhaps you could try to see if
unsigned long long var;
is accepted by your compiler.

On most machines, this would be a 64-bit variable, and would thus solve any messy emulation.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Ounter of 6 bit and i need a counter of 48 bit

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap