[Solved] How can I modify this code to insert random text into the console and it reverses it for me? [closed]

You need a mechanism to input text from a source e.g. keyboard or command-line etc. Given below are some examples: From keyboard: import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print(“Enter a text: “); String s = scanner.nextLine(); for (int i = s.length() – 1; i … Read more

[Solved] Code to reverse a string: “Undefined symbols for architecture x86_64” [closed]

The compiler complains about char* reverse(string input); is not defined but char* reverse(char* input); is. Unrelated fault. char* reverse(char* input) { char* reversed; reversed = new char(sizeof(input) – 1); // <———– 2 FAULT here for(int i = 0; i != ‘\0’; i++) { // <— and here char* j = reversed + sizeof(input – 1); … Read more

[Solved] a program to reverse each word in a string( ive read the previous solutions but im looking for one using the functions i only here [closed]

#include <stdio.h> #include <string.h> #include <conio.h> int main(void){ char A[81][81] = {0}; int t=0,j=1,k=0,l; puts(“Input a sentence (max 80 character)”); scanf(“%80[^\n]”, A[0]);//’gets’ has already been abolished, it should explore a different way. while (A[0][t] != ‘\0’){ if(A[0][t] == ‘ ‘){ ++j; k=0; while(A[0][t] == ‘ ‘)//Skip spaces ++t; } else { A[j][k++] = A[0][t++]; } … Read more