reverse

How to take input file, reverse word order, write to output file in C++

允我心安 提交于 2020-01-03 06:35:50
问题 Take the contents of an input text file and write them in reverse order of words to an output file. Your program can ignore line breaks. You will need to use arrays. (unnecessary crap removed) Aaaaah, panic, please help! EDIT: What I have so far. Still lost on how to reverse word order now. //Kristen Korz //CIS 22A //This program reads an input file and writes the words in reverse order to an output file. #include <iostream> #include <fstream> using namespace std; int main() { //create and

How to reverse and print a string in assembly language

懵懂的女人 提交于 2020-01-03 04:47:05
问题 So my assignment was to write a program in assembly code that could make a statement, recieve a user inputted string. Print that string then reverse it using the cpu stack and print it again. this is what I have thus far. INCLUDE Irvine32.inc .data buffer byte 20 DUP(0) byteCount DWORD ? Question byte "Please enter your name." ,0 Greeting byte "Hello " ,0 Statement byte " Here is your name backwards" .code main proc mov edx , OFFSET Question call WriteString call CRLF Call CRLF mov edx,

Reversing an array in assembly

南楼画角 提交于 2020-01-02 17:54:18
问题 I'm trying to figure out how to reverse an array in assembly in a way that makes it as flexible as possible. The code I have so far is this: ; This program takes an integer array and reverses it's elements, using a loop, the SIZE, TYPE and LENGTHOF ; operators. TITLE lab4 (lab4.asm) INCLUDE Irvine32.inc .data arr DWORD 1h, 2h, 3h, 4h, 5h, 6h ; Array of integers with 6 elements. len DWORD LENGTHOF arr / 2 ; The length of the array divided by 2. ;rng DWORD LENGTHOF arr ; The complete length of

Exactly when does the reverse direction of an axis apply?

不问归期 提交于 2020-01-01 17:27:13
问题 Those who are familiar with XPath know that some axes, such as preceding:: , are reverse axes. And if you put a positional predicate on an expression built with a reverse axis, you may be counting backward instead of forward. E.g. $foo/preceding-sibling::*[1] returns the preceding sibling element just before $foo , not the first preceding sibling element (in document order). But then you encounter variations where this rule seems to be broken, depending on how far removed the positional

Reverse audio file in Android

倾然丶 夕夏残阳落幕 提交于 2020-01-01 03:26:12
问题 I am in the very ealy stages of developing this app but looking into it I have already reached a problem. I need to be able to play an audio file backwards (you know like to reveal hidden messages ;)). I have no experience working with audio on android and have no idea if this is even possible. I found a question on here which solves the problem in java (Click Here For Question) But this makes use of the javax.sound library which android does not support. Will I need this library to solve

a data structure with key as a cluster of words and value as a single word or string

老子叫甜甜 提交于 2019-12-31 07:49:10
问题 I want to create a data structure that is able to map a cluster or group of words to a single word or string , it can be thought as of a reverse of what a dictionary does in python . 回答1: You can use a regular dict: targetword = "good" wordmap = { "best": targetword, "positive": targetword, "awesome": targetword, "fantastic": targetword } 来源: https://stackoverflow.com/questions/37158160/a-data-structure-with-key-as-a-cluster-of-words-and-value-as-a-single-word-or-st

Delphi Reverse order of bytes

Deadly 提交于 2019-12-31 01:50:33
问题 I have been trying to write a function that takes two pointers (an input and an output) and writes the bytes from the input into the output in reverse order. So far I have not been able to make it work correctly. procedure ReverseBytes(Source, Dest: Pointer; Size: Integer); var Index: Integer; begin Move(Pointer(LongInt(Source) + Index)^, Pointer(LongInt(Dest) + (Size - Index))^ , 1); end; Can anyone please suggest a better way of doing this. Thanks. 回答1: procedure ReverseBytes(Source, Dest:

How to find the main function's entry point of elf executable file without any symbolic information?

纵然是瞬间 提交于 2019-12-30 01:21:25
问题 I developed a small cpp program on platform of Ubuntu-Linux 11.10. Now I want to reverse engineer it. I am beginner. I use such tools: GDB 7.0, hte editor, hexeditor . For the first time I made it pretty easy. With help of symbolic information I founded the address of main function and made everything I needed. Then I striped ( --strip-all ) executable elf-file and I have some problems. I know that main function starts from 0x8960 in this program. But I haven't any idea how should I find this

Segmentation Fault when writing to a string [duplicate]

二次信任 提交于 2019-12-27 11:45:07
问题 This question already has answers here : Why do I get a segmentation fault when writing to a string initialized with “char *s” but not “char s[]”? (17 answers) Closed 6 years ago . I am trying to write an in-place reverse function and have followed online code pretty much exactly, yet running the following program throws a bus error. Am I passing the wrong kind of argument to reverse()? void reverse(char *str) { char * end = str; char tmp; if (str) { while (*end) { ++end; } --end; while (str

How can I reverse the words in a sentence without using built-in functions?

那年仲夏 提交于 2019-12-25 08:42:53
问题 This was the interview question: How to convert Dogs like cats to cats like Dogs ? My code shows: cats like cats . Where am I making the mistakes? #include <iostream> using namespace std; int main() { char sentence[] = ("dogs like cats"); cout << sentence << endl; int len = 0; for (int i = 0; sentence[i] != '\0'; i++) { len++; } cout << len << endl; char reverse[len]; int k = 0; for (int j = len - 1; j >= 0; j--) { reverse[k] = sentence[j]; k++; } cout << reverse << endl; int words = 0; char