C++ Program File

You might also like

Download as doc or pdf
Download as doc or pdf
You are on page 1of 15

Project Report Binary Converter

A
PROJECT REPORT
ON

“BINARY CONVERTER”

Submitted to: Submitted by

Mrs. Monika Rohilla Archit Gupta


P.G.T (Computer Science) Class- XII A
K.V. Sainik Vihar Roll No. 6230440
Delhi-36 K.V. Sainik Vihar Delhi
Delhi-36

1 | Page
Project Report Binary Converter

CERTIFICATE
This is to certify that the project work entitled “BINARY
CONVERTER” for has been carried out by Archit Gupta,
Student of the Class XII A in order to fulfill the required
curriculum of the course “Computer Science Project Work”.

This project is result of his continuous hard work and


determination. He has worked very sincerely and honestly
under my supervision and guidance.

Project Guide:
Mrs.Monika Rohilla
PGT(Comp Sc.)
K.V. Sainik Vihar,
Delhi

2 | Page
Project Report Binary Converter

ACKNOWLEDGEMENT

My heartful gratitude and thanks to Almighty God, my parents


and other family members and friends without whose unsustained
support, I could not have made this career in.

I wish to place on my record my deep sense of gratitude to


my project guide, Mrs.Monika Rohilla, PGT (Computer Science)
for his constant motivation and valuable help through the project
work.

Finally I would like to thank my friends for their cooperation to


complete this project.

3 | Page
Project Report Binary Converter

INDEX

1. Introduction
1.1 Introduction to Project

2. Selected Software

3. Coding

4. Output Screens (Forms)

5. System Testing and Implementation

6. Conclusion

7. Scope for Expansion

8. Bibliography

4 | Page
Project Report Binary Converter

INTRODUCTION

5 | Page
Project Report Binary Converter

Introduction to Project:

This project entitled “BINARY CONVERTER” is basically


designed in C++ language.
It is used to convert the characters, strings or integers into its
binary equivalent.

Selected Software:

- C++

6 | Page
Project Report Binary Converter

CODING

7 | Page
Project Report Binary Converter

// Binary Converter

/********************************************************/
/* Binary converter */
/*
/********************************************************/
/*using namespace std;*/
#include <iostream.h>
#include<string.h>
/*#include <cstring>*/
/*#include <cstdlib>*/
#include<stdlib.h>

char *entry, letter, choice[2];


int ascii, len, binary[8], total;
void prog();

int main()
{
prog();
return 0;
}

void prog()
{
entry = new char[501];
/* entry should be dynamic, otherwise a new
string entry of 501 chars would be created
each time function is called!
Talk about memory hog! */
cout<<"Enter string to convert (up to 500 chars): ";
cin.getline(entry, 500);
len = strlen(entry); /* get the number of characters in entry. */
/* this loop is executed for each letter in the string. */
for(int i = 0; i<len; i++)
8 | Page
Project Report Binary Converter

{
total = 0;
letter = entry[i]; /* store the first letter */
ascii = letter; /* put that letter into an int, so we can
see its ASCII number */
while(ascii>0) /* This while loop converts the ASCII # into binary,
stores it backwards into the binary array. */
{
/* To get the binary code one must take the decimal number in
question, take it and divide it by two repeatedly, save
the remainder (which will become the binary number), save
the whole number, divide by two, and repeat the whole
process until 0 is reached. This if-else statement serves
this functionality, by getting the remainder of the ascii
code, storing it in the array and then dividing the int
ascii by two */
if((ascii%2)==0)
{
binary[total] = 0;
ascii = ascii/2;
total++; /* increasing by one each time will yeild the
number of numbers in the array. */
}
else
{
binary[total] = 1;
ascii = ascii/2;
total++;
}
}
total--; /* due to data type factors, the program will actually
add a 0 at the end of the array that is not supposed
to be there, decrementing total will solve this
problem, as that 0 will not be displayed. */
/* this while loop displays the binary code for that letter. */
9 | Page
Project Report Binary Converter

while(total>=0)
{
cout<<binary[total];
total--;
}
}
delete[] entry; /* free up the memory used by entry */
cout<<endl<<"Do again(1 = yes, 2= no)?: ";
cin.getline(choice,3);
if(choice[0] == '1')
prog(); /* program is recursive, it calls itself. It's kinda
like a function loop of sorts. */
else
exit(0); /* quits the program */
}

10 | P a g e
Project Report Binary Converter

OUTPUT

11 | P a g e
Project Report Binary Converter

Enter string to convert (up to 500 chars): Archit Gupta


10000011110010110001111010001101001111010010
000010001111110101111000011101001100001
Do again (1 = yes, 2= no)?: 1
Enter string to convert (up to 500 chars): Yogesh Goel
10110011101111110011111001011110011110100010
00001000111110111111001011101100
Do again (1 = yes, 2= no)?: 2

12 | P a g e
Project Report Binary Converter

TESTING
SYSTEM TESTING

During system testing the system is used experimentally used to


ensure that the software does not fail, i.e., it will run according to its
specification and in the way the users expect. Special test data are
input for processing and the results examined. A limited number of
users may be allowed to use the system to see whether they try to use
it in unforeseen ways. It is preferable to discover any surprises before
the organization implements the system.

IMPLEMENTATION AND EVALUATION

Implementations is the process of having systems personnel


checkout and put new equipment into use, train employee, installs the
new application and construct any files of data needed to use it.
Evaluation of the system is performed to identify its strengths
and weakness.

13 | P a g e
Project Report Binary Converter

Conclusion:

Finally we have got the conversion of characters,


integers, and strings of characters into its binary
equivalent.

Scope for Expansion:

In future we may include octal conversion and


hexadecimal conversion in the following project.

14 | P a g e
Project Report Binary Converter

Bibliography:

- Computer Science Project Work with C++.


Author- Sumita Arora.

15 | P a g e

You might also like