C++ :: Encrypting MAC Address To 4 Digit Number

Apr 4, 2014

I want to encrypt Mac address to 4 digit number which can be decrypted to original MAC address.

View 9 Replies


ADVERTISEMENT

C/C++ :: Swap A Digit From A Number With Another Digit Using Function

Oct 26, 2014

Write a function which will take 3 arguments. The function needs to return a new number which is formed by replacing the digit on a given position in the number with a digit which is carried as an argument (the position in the number is counted from right to left, starting with one). Write a main program which will print the newly formed number.

Examples:
A function call of 2376, 3 and 5 should return the number 2576
A function call of 123456, 4 and 9 should return the number 129456

What I succeeded to do so far:
Figure out the logic for swapping the digit and write working code for it (in the main function).

What I failed to do so far:
Write a function which will return the desired result.

What is my problem:
I tried writing a function to do this, but as you see from my calculations, my result is divided in 3 parts. I don't know how to return more variables from a function.

Code:

#include <stdio.h>
int main() {
int inputNumber, swapPosition, swapDigit;
scanf("%d%d%d", &inputNumber, &swapPosition, &swapDigit);
int i, numberPart1 = inputNumber;
for (i = 1; i <= swapPosition; i++)

[Code] ...

View 8 Replies View Related

C++ :: Convert 8-digit Binary Number To Decimal Number?

Jul 6, 2013

Code: Complete the program below which converts a binary number into a decimal number. Sample outputs are shown belowComplete the program below which converts a binary number into a decimal number. Sample outputs are shown below.

Sample Output 1:

8-bit Binary Number => 11111111
Decimal Number = 255

Sample Output 2:

8-bit Binary Number => 10101010
Decimal Number = 170

Sample Output 3:

8-bit Binary Number => 101010102
Number entered is not a binary number

#include <iostream>
using namespace std;
int main()
{
int num;

[code]....

View 2 Replies View Related

C++ :: Converting 4 Digit Number Into BCD Number?

Sep 10, 2014

I'm having trouble converting a 4 digit number into a BCD number, in the program I did below I was able to convert a 2 digit number into BCD, but I do not know how to convert a 4 digit number or how to start it.

#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char *argv[])

[code]....

View 2 Replies View Related

C :: Storing A 10 Digit Number

Dec 9, 2014

I wanted to find all the prime until a specified limit in C. I use the Sieve of Eratosthenes. But when I define the limit to anything more than a 7 digit number the program terminates.

Code:

#include<stdio.h>
#define limit 1000000000
int main(void)
{
unsigned long long int i,j;
int primes[limit] = {0};
//int count =0;
for(i=2;i<limit;i++)
}

[code]....

I believe that this might be because the size cannot be declared array cannot be more than the a 7 digit number. I think so. how to store a 10 digit number in C?And can't unsigned long long hold a 10 digit?

View 1 Replies View Related

C :: How To Get Each Digit Of A Number From Array

Apr 14, 2013

I have an array join[], some of its elements are single digit and some are numbers. I want to print the output in single digit form.Like in below code

Code:
int join[3]= {12,0,3};
int split;
int j;
for (j=0;j<3; j++) {

[Code] ....

My code won't consider array element "0". How can i fix it for that too.

Code: I want output should be like
1
2
0
3

View 4 Replies View Related

C++ :: Trying To Remove First Digit Of Any Number

Dec 18, 2013

I am trying to remove the first digit so if the user enters 12345 it should output 2345 the code i have works only for removing the last digit how would i go about removing the first one?

#include <iostream>
using namespace std;
int removeFirst(int n);
int main(){
int n, m;
cout << "enter number" << endl;

[Code] ....

View 4 Replies View Related

C/C++ :: How To Store 50 Digit Number

Sep 14, 2013

what is the data type of a variable to store 50 digit number in c? and what is the data type specifier for that?

View 5 Replies View Related

C++ :: Print Last Digit Of Number Output Always Become 6?

Oct 26, 2013

i just started learning programming and i just wanna know how come when i try to print the last digit of a number the output always become 6?

View 4 Replies View Related

C :: Storing 12 Digit Number On 32 Bit Architecture

May 8, 2014

So I have to ask the user to enter a positive 12 digit number, and it has to be 12 digits exactly. I thought I'd do

Code:

unsigned long long int x;
do{...}
while(!(x>99999999999 && x<1000000000000));

This would obviously be fine on my 64 bit machine, but the code will be ran on a 32 bit one, where unsigned long long is, if I'm not mistaken, 32 bits. Which has a max value of 4 billion and something.

View 13 Replies View Related

C++ :: All Possible Combinations For 4 Digits From A 5 Digit Number

Jun 23, 2014

How to get all the possible combinations for 4 digits from a 5 digit number. I need a pair that has both 5 digits and four digits. their sum must be equal to a five digit user input. i.e.

user input : 14690
output:
14690 has pairs 12345 + 2345
2345 came from 12345
lets say that x = 12345 and y =2345
besides y == x%10000

other formula can i have since if i use % and / i will have a lot of declarations....

View 2 Replies View Related

C++ :: Three Digit Random Number Generator

Aug 4, 2013

How to produce a code that will satisfy the following constraints. I don't really know C++

- Produces a random three number positive integer between 001 - 504.

- Changes the output number every 24 hours on a website.

View 2 Replies View Related

C++ :: How To Restrict User To Enter Four Digit Number Only

Aug 22, 2014

I am trying to write up something to have a user to enter a four digit number. Only four digits, Ex: 0001, 0116, or 9999. There is no getting around the selection 0001 or 0002. I understand if not done correctly, the first three 0's will be ignored.

I've been just playing around with what I have below but I just don't remember how to do it nor can I find a good example online to figure it out. I know it is not correct just typing to try to remember. I am aware that it is gibberish right now, this is just me brainstorming.

int number;
cout<<("Please enter the four digit number(Ex: 0001):
");
cin>> setw(2) >> number;
cout<<)"Please enter four digit date. Two digits for month and two digits for year:
");
cin>> date;
if (number< || number > 30)
cout << "Invalid choice. Try again." << endl;
cin.clear();

View 2 Replies View Related

C++ :: Highest Digit In A Number (recursive Function)

Dec 23, 2013

I have this example problem in my school coursebook. How this program works? It determines the highest digit in a number.

#include <iostream>
using namespace std;
int m(int n) {
int a,b;

[Code] ....

View 4 Replies View Related

C++ :: Find Sum Of All Digits In Number Until Sum Becomes A Single Digit

Jan 24, 2015

Given an integer, find the sum of all the digits in the number until the sum becomes a single digit. E.g. sum of digits of 9264 = 21. Then sum of 21 = 3.

View 2 Replies View Related

C++ :: Customers Plan - Output Name And Two Digit Number Next To It?

Nov 8, 2013

//using bloodshed dev c++ compiler
//How can I output the name and a two digit number next to it
//example would be Indiana Jones 20
#include<iostream>
#include<string>
using namespace std;
class Customer {

[Code] .....

View 3 Replies View Related

C :: Program That Will Generate But Not Display Three-digit Target Number

Oct 6, 2014

Write a program that will generate, but not display, a three-digit "target" number that has three distinct digits. (Hint: use random number generator.) Then, input a maximum of ten user guesses and for each guess, output the number of hits and matches in the guess. Stop when the user guesses the number or runs out of guesses. For example, if the target is 427, the guess 207 has one hit (7) and one match (2).

View 8 Replies View Related

C++ :: Input Validation For 5-digit PIN Number Read From Integer

Oct 22, 2014

The problem states that i need to accept any pin number between "00000" and "99999". I need to read the PIN the user enters as an integer. The problem is that if the PIN is read as an integer, the PIN "01111" will be "1111" which is invalid and the pin "00001" would be read as "1" which is also invalid. How would I go about fixing this problem for PIN numbers that start with a "0"? Again I cannot read the PIN as a char array or string.

View 2 Replies View Related

C/C++ :: Converting Two Digit Hexadecimal Number To Binary Representation

Jan 25, 2014

The program is supposed to convert a two digit hexadecimal number to its binary representation. My code runs without any problems but I do not know how to limit the user's input to two digits only. For example the person can input "1ABC" and the program will give the binary representation and I need it to only accept two digit only like for example "1A".

#include<stdio.h>
#define MAX 1000
int main(){
char binaryNumber[MAX],hexaDecimal[MAX];
long int i=0;
printf("Enter a two digit hexadecimal number: ");

[Code] ....

View 8 Replies View Related

C/C++ :: Bank Management Project - 6 Digit Account Number

Mar 1, 2015

I am trying to figure out the best way to approach a part of a project I am working on for school. I need to put in a 6 digit account number that will not allow duplicates for another user. How to approach this .

View 1 Replies View Related

C++ :: Create Program That Has User Input 5 Digit Number?

Mar 9, 2013

Im trying to create a program that has the user input a 5 digit number. If it's between 10000 & 99999, it will do one thing..(just saying 'yes' for now. Outside those numbers will prompt the user to input again. However, if the user inputs the exact digits 76087, it should display 'term'.

This current code is displaying 'term' whenever the user inputs the 5 digits.

Code:

#include <iostream>
using namespace std;
int main() {
int pin;
cout << "Welcome to Movie Food
Enter your 5-digit pin code: " ;

[code]....

View 14 Replies View Related

C++ :: Function That Should Return Number Of Digits In Integer Returns Last Digit

Feb 18, 2015

Code:
int exploder(int number,int array[]) {
int functi = 0;
int digit = number % 10;
while (number > 0) {

[Code] ....

View 2 Replies View Related

C++ :: Convert To Int Part Of 1000 Digit Long Number Defined In Char Array

Jan 28, 2015

How do I convert just the number from position 4 to 15 from this char array and convert to int and save to variable

char numbers[]="54155444546546545643246543241465432165456";

the real char got 1000 digits this is just example how do i convert chars from numbers[4] to numbers[15] and save them as one number ? in this case i will get int x = 5444546546545643 as u can see char numbers as a example above

View 4 Replies View Related

C/C++ :: Read Name / Phone Number And Address From A File - How To Use Fscanf

Nov 28, 2014

I am trying to read the name, phone number and address from a file ... Here is the code but it doesn't work and i don't know where is the problem ...

#include <stdio.h>
#include <stdlib.h>
struct PhoneBook{
        char name[50];
        int phoneNumber;
        char address[50];

[Code] ....

And here is the contents of the file:
jack 01014 jgd

Moh 02925 Tyeu

When I run it on dev c++, a message appear saying that the prog has stopped working and no output appears. I want to put the name in user[n].name, the phone number in user[n].phoneNumber and the address in user[n].address

View 1 Replies View Related

C++ :: Encrypting With User-Given Key?

May 3, 2013

I am working on a program where a user first enters a key of 26 characters, they then choose the number of lines they'd like to use with a max length of 40. Once they have entered the key and chosen the number of lines, they then enter text into the chosen number of lines, before that text is ultimately encrypted. I have it working as far as accepting the user's 26-character key, accepting their choice for number of lines, but when the user is typing in their lines of text, it only allows 6 lines before it moves to where the text would be encrypted.

View 3 Replies View Related

C++ ::  Decrypting And Encrypting Following A Certain Protocol?

Mar 26, 2014

I have a certain method of encrypting text. You get the first character of the word. For example in the word "hacker", you get 'h', and then you get the last character 'r'. The encrypted word until now is "hr". Then we get the same word with the 'h' and 'r' removed, now it's "acke". I do the same thing and get the first character 'a' and the last one 'e' and them to the encrypted word: it is now "hrae".

The left letters of the word are "ck", again we do the same thing and take the first character 'c' and the last character 'k' and and add them to the new encrypted word so it is "hraeck". The above word has an even number of characters and at the end had 2 characters left 'c' and 'k',first and last, in some cases of words with an odd number of characters, only one character is left! I'm completely lost on how to encrypt and decrypt this.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved