I am making a text encrypter and I have to convert text into ASCII codes. I know how to convert a single character into ASCII -
#include <iostream> using namespace std; int main() { cout<<"Text to ASCII converter"<<endl<<"Enter text to convert into ASCII - "; char text; //defining input type, which is single character
[Code] ....
Try it here - URL.....Is there any way to run a similar program, which converts a string with spaces into ASCII code?
i am doing an embedded project on avr microcontroller ATmega8515.actually my project is smart card based electricity billing using UART interfacing..so in this module HEX to ASCII conversion is not possible for me...
Using C . I have been tasked (for a University assignment) to create a program that will enable a user to upload an image and convert that image into ASCII text using SDL on a Linux system. I've managed to open a window, display an image (non-selected) and convert it into grayscale using
case SDLK_g: for (int y = 0; y < image->h; y++) { for (int x = 0; x < image->w; x++) { Uint32 pixel = pixels[y * image->w + x]; Uint8 r = pixel >> 16 & 0xFF; Uint8 g = pixel >> 8 & 0xFF; Uint8 b = pixel & 0xFF; Uint8 v = (0.212671*r)+(0.715160*g)+(0.072169*B)/>; pixel = (0xFF << 24) | (v << 16) | (v << 8) | v; pixels[y * image->w + x] = pixel;
I am absolutely clueless as to how I can get the user to upload an image to the program and then begin the image -> ASCII conversion. I've found seem to be written in C++ or C# to make the conversion I should be using the GetPixelColour command?
The code is supposed to convert characters from an array into their respective ascii integers, and append a 0 if the number is less than 3 digits long. It then supposed to put it all together into one string.
Code: #include <stdio.h> #include <string.h> #include <stdlib.h> int main(void){
char file[] = "This is a test"; char *ptr = file; int length = strlen(file); int i, numbers[length];
I have some ascii characters in a char variable.ex - char buf[100]="ab*(z&";
So each of the char in that char array will have some hex value.ex- *'s hex value is '2a'.
And I have a long long int variable in which there is a 64 bit hex value.
ex- long long int k=0x0000888888888888;
Now i want to subtract the char buff's hex value in k. How to accomplish it.
That is 0x0000888888888888 - 0x000061622a287a26 = 0x000027265e600e62 (final result in a buffer or a long variable is okay)
Later i want to reverse the result as 26e006e56272.It should be stored in a variable such that i should be able to access each byte from it(ex- '72'(last 2 hex digits))
I know how to find find ASCII value of given character, but I am not getting how to find ASCII value of given string. For example I want to find ASCII value of string "HELLO",so how to do that.
I have to Write a program to produce that makes four triangles and a pyramid. I have to ask the user they height of the triangle and prevent the user from entering a height any larger than 25. It should look like this.
Enter the height of your triangle/pyramid: 3
*** ** *
* ** ***
* ** ***
*** ** *
* *** *****
im having tourble with 3 and 4th and also pyramid.
HERES WHAT I HAVE SO FAR.
#include <iostream> #include <iomanip> #include <string> using namespace std; int main () { int input = 0; cout << "Please enter the height of your triangle/pyramid: ";
I'm currently working on a project that utilitzes a Caesar Cipher. Basically, it reads input from a file and then, depending upon the input file, requires encrypting or decrypting. The cipher used to encrypt/decrypt simply adds/subtracts an integer from each character in the input file. All input is lowercase alphabetic characters (ASCII 97-122). My problem is trying to figure out how to wrap the ciphered characters, e.g., if the cipher require a shift of +5 and the character read was 'x', a shift of +5 to the right would produce 'c' (beginning with 'x' and counting up 5 letters: 'y', 'z', 'a', 'b', 'c').
I've written some crude and cumbersome loops that will work, but there has to be a better way. It is my understanding that it can be done using the modulus operation, %, but I cannot figure out how. I spent several hours trying to figure out the modulus approach, but no luck.
I have a C program where I rapprendentare a table using a 10x10 matrix and create the chart with the game piece and the matrix in a spiral. I do not know how to start or even how to create the table with the ascii codes. is a task for school and I need to do it soon.
for an assignment we need to create basically a program that asks the user for the result of standard six-sided die rolls (numbers from 1 to 6). The program will prompt the user with "Enter a die roll or 0 to exit " for the first entry and Next die roll? for all subsequent entries. The program will continue reading die rolls from the user until the user enters 0. At this point, the program prints two newline characters (one blank line) and finally, the bar chart showing the number of times each die roll has been entered, and then terminates.If the user enters an invalid number, the program will just ignore it, and ask for another number. Only numbers 1-6 inclusive and 0 are valid.
Example output Enter a die roll or 0 to exit 6 Next die roll? 6 Next die roll? 7 Next die roll? 4 Next die roll? 0
How to give input with text for this function.i already create function for this but i dn't know give input as non ASCII value(0-32) that Cobain with string or simple text.
here is what it does;it reads from a text file and converts the characters to ascii numbers and stores them in 1D array.what I am trying to is storing these ascii codes in 2D array.
I'm trying to write a lot of sample code to practice but I can not figure out how to take a string and sort each character in order of their increasing ASCII codes. I'm getting stuck trying to separate each letter to determine it's ASCII code. I know I have to use an array somehow, So far, this is my code:
I've written a Hexadecimal/ASCII chart, and would like to be able to show a larger version of the selected ASCII on screen. Is there a way to read the individual lines of bytes that make up a letter/symbol/number to show on screen.
|0|0|0|0|0|0|0|0| = 0 |0|1|0|0|0|0|1|0| = 66 O O ( These 'O' represent ASCII 219 ) |0|0|1|0|0|1|0|0| = 36 O O |0|0|0|1|1|0|0|0| = 24 OO |0|0|0|1|1|0|0|0| = 24 OO |0|0|1|0|0|1|0|0| = 36 O O |0|1|0|0|0|0|1|0| = 66 O O |0|0|0|0|0|0|0|0| = 0
To make a large graphic X.
I'm using Microsoft 2012 Express, in the console. I don't feel comfortable yet programming in Windows mode.
1) Write a program that asks the user for a a single character and two XY coordinates. The two X and two Y values should all be integers between 0 and 50. The character should be a printable ASCII character with values between and including ' !' (ascii value 33) and '~' (ascii value 126).
2) Your program should then draw a rectangle made up of the user selected character where the upper left corner is at X1; Y 1 and the lower right corner is at X2; Y2. Be sure to print the appropriate number of blank lines (having spaces in the blank rows is OK) in the beginning and pad each row of your rectangle with X1 leading spaces.
The Output is supposed to be similar to this:
(X1,Y1) = (0,0) , (X2,Y2) = (4,4), the character = ^
^^^^ ^^^^ ^^^^ ^^^^
What I am having trouble understanding is printing between certain ASCII values (ASCII has never been discussed in class).
Another thing I am having trouble with is the main part of the assignment. From what we are currently discussing is loops and the assignment is covering nested loops. My code looks similar to this: Code:
#include <stdio.h> int main (void) { int X1, Y1, X2, Y2; char cRec; printf("Enter a character: "); scanf("%c", &cRec);
[Code] .....
My thinking on the assignment is that you want the X1 coordinate to increase to the value of X2 (same for Y1 and Y2). Is this thinking wrong?
Im programming a roguelike game using visual c++ Microsoft express 2010 and i made a multidimensional array for my first map. I have the walls as # and was wondering how i could turn those into ascii symbol 219. Also i need to know how to turn specific text certain colors.