#include<stdio.h>
#include<conio.h>
void main()
{
char st[30];
int i,j,k;
printf("Enter your string\n");
scanf("%s",&st);
for(i=0;i<30;i++)
{
for(j=i+1;j<30;j++)
{
if(st[i]==st[j])
{
st[j]=7;
}
}
}
printf("your optimal string without Dublicacy \n %s\n",st);
getch();
}
when you run this programme gives output successfully but also give bell for each dublicate character.
But...........
#include<stdio.h>
#include<conio.h>
void main()
{
char st[30];
int i,j,k;
printf("Enter your string\n");
scanf("%s",&st);
for(i=0;i<30;i++)
{
for(j=i+1;j<30;j++)
{
if(st[i]==st[j])
{
st[j]=8;
}
}
}
printf("your optimal string without Dublicacy \n %s\n",st);
getch();
}
this programme gives successfully output but not gives bell .
since ascii value of 7 is a bell and ascii value of 8 is a backspace.
see below...
#include<conio.h>
void main()
{
char st[30];
int i,j,k;
printf("Enter your string\n");
scanf("%s",&st);
for(i=0;i<30;i++)
{
for(j=i+1;j<30;j++)
{
if(st[i]==st[j])
{
st[j]=7;
}
}
}
printf("your optimal string without Dublicacy \n %s\n",st);
getch();
}
when you run this programme gives output successfully but also give bell for each dublicate character.
But...........
#include<stdio.h>
#include<conio.h>
void main()
{
char st[30];
int i,j,k;
printf("Enter your string\n");
scanf("%s",&st);
for(i=0;i<30;i++)
{
for(j=i+1;j<30;j++)
{
if(st[i]==st[j])
{
st[j]=8;
}
}
}
printf("your optimal string without Dublicacy \n %s\n",st);
getch();
}
this programme gives successfully output but not gives bell .
since ascii value of 7 is a bell and ascii value of 8 is a backspace.
see below...
| Binary | Oct | Dec | Hex | Abbr | [a] | [b] | [c] | Name |
|---|---|---|---|---|---|---|---|---|
| 000 0000 | 000 | 0 | 00 | NUL | ␀ | ^@ | \0 | Null character |
| 000 0001 | 001 | 1 | 01 | SOH | ␁ | ^A | Start of Header | |
| 000 0010 | 002 | 2 | 02 | STX | ␂ | ^B | Start of Text | |
| 000 0011 | 003 | 3 | 03 | ETX | ␃ | ^C | End of Text | |
| 000 0100 | 004 | 4 | 04 | EOT | ␄ | ^D | End of Transmission | |
| 000 0101 | 005 | 5 | 05 | ENQ | ␅ | ^E | Enquiry | |
| 000 0110 | 006 | 6 | 06 | ACK | ␆ | ^F | Acknowledgment | |
| 000 0111 | 007 | 7 | 07 | BEL | ␇ | ^G | \a | Bell |
| 000 1000 | 010 | 8 | 08 | BS | ␈ | ^H | \b | Backspace[d][e] |
| 000 1001 | 011 | 9 | 09 | HT | ␉ | ^I | \t | Horizontal Tab[f] |
| 000 1010 | 012 | 10 | 0A | LF | ␊ | ^J | \n | Line feed |
| 000 1011 | 013 | 11 | 0B | VT | ␋ | ^K | \v | Vertical Tab |
| 000 1100 | 014 | 12 | 0C | FF | ␌ | ^L | \f | Form feed |
| 000 1101 | 015 | 13 | 0D | CR | ␍ | ^M | \r | Carriage return[g] |
| 000 1110 | 016 | 14 | 0E | SO | ␎ | ^N | Shift Out | |
| 000 1111 | 017 | 15 | 0F | SI | ␏ | ^O | Shift In | |
| 001 0000 | 020 | 16 | 10 | DLE | ␐ | ^P | Data Link Escape | |
| 001 0001 | 021 | 17 | 11 | DC1 | ␑ | ^Q | Device Control 1 (oft. XON) | |
| 001 0010 | 022 | 18 | 12 | DC2 | ␒ | ^R | Device Control 2 | |
| 001 0011 | 023 | 19 | 13 | DC3 | ␓ | ^S | Device Control 3 (oft. XOFF) | |
| 001 0100 | 024 | 20 | 14 | DC4 | ␔ | ^T | Device Control 4 | |
| 001 0101 | 025 | 21 | 15 | NAK | ␕ | ^U | Negative Acknowledgement | |
| 001 0110 | 026 | 22 | 16 | SYN | ␖ | ^V | Synchronous idle | |
| 001 0111 | 027 | 23 | 17 | ETB | ␗ | ^W | End of Transmission Block | |
| 001 1000 | 030 | 24 | 18 | CAN | ␘ | ^X | Cancel | |
| 001 1001 | 031 | 25 | 19 | EM | ␙ | ^Y | End of Medium | |
| 001 1010 | 032 | 26 | 1A | SUB | ␚ | ^Z | Substitute | |
| 001 1011 | 033 | 27 | 1B | ESC | ␛ | ^[ | \e[h] | Escape[i] |
| 001 1100 | 034 | 28 | 1C | FS | ␜ | ^\ | File Separator | |
| 001 1101 | 035 | 29 | 1D | GS | ␝ | ^] | Group Separator | |
| 001 1110 | 036 | 30 | 1E | RS | ␞ | ^^[j] | Record Separator | |
| 001 1111 | 037 | 31 | 1F | US | ␟ | ^_ | Unit Separator | |
| 111 1111 | 177 | 127 | 7F | DEL | ␡ | ^? | Delete[k][e] | |
|
|
|




No comments:
Post a Comment