[Solved] Name cannot be display [closed]

I have modified your code. Please see the snipet code below #include <stdio.h> #include <conio.h> #define MAX 25 char welcomeMsg[]= “Please enter your name without ‘*’ or # ” ; char errorMsg[]= “\nError, please re-type your name. “; void main(void) { int j; char input; char name[MAX]; j=0; puts(welcomeMsg); do { input = getche(); if(input … Read more

[Solved] “\u00e1n” to “á” in PHP [closed]

EDIT Now, I’ve figured out the correct, working answer based on the article I found. Here is it: function unicode2utf8($str) { $a=json_decode(str_replace(“\n”,”<br>”,'[“‘.$str.'”]’)); return str_replace(“<br>”,”\n”,$a[0]); } PHP: echo unicode2utf8(“Tom\u00e1nsson\n Eriksen\n Gilverto\n”); Output: Tománsson Eriksen Gilverto ORIGINAL I’ve found an article about the same problem here ( http://www.welefen.com/php-unicode-to-utf8.html ) The solution is the following function function unicode2utf8($str){ … Read more

[Solved] how can i pass from char[i] to a double? [closed]

You can use functions std::stringstream from sstream or strtod from cstdlib or stod (If you are using C++11) as per your need. Quoting example from cplusplus.com // stod example #include <iostream> // std::cout #include <string> // std::string, std::stod int main () { std::string orbits (“365.24 29.53”); std::string::size_type sz; // alias of size_t double earth = … Read more

[Solved] How to Convert int into char string

What? A character is typically just that, one character. Not seven. You can do a wide character: char what=”12-4-30″; but I think that’s more bits than most compilers will let you have in a char, so it’s not going to work. If you meant a string of character, you should use snprintf(): char what[32]; snprintf(what, … Read more

[Solved] C++ sum char and integer

Here s will be “3xzy1” as s[2]=’x’+2; makes s[2] equal to ‘z’, where ‘z’ is a character, not a string. ‘x’-1==’w’; ‘x’+1==’y’; ‘x’+2==’z’ solved C++ sum char and integer

[Solved] C language, Hangman game, if question, “char” and “char*” operand issue when comparing answer(the user input) == word(hangman word) [closed]

First off, you were using the strcpy_s function wrong, you didn’t give the length of the string. So I changed it like; strcpy_s(mask, m, word[x]); And also, the format specifier we’re going to use while getting a string from the user will be %s like; scanf_s(“%s”, &answer); Finally, I prefer using strcmp function to compare … Read more

[Solved] Convert a char list list into a char string list in OCAML

Here is a very compact implementation: let to_str_list = List.map (fun cs -> String.concat “” (List.map (String.make 1) cs)) It looks like this when your call it: # to_str_list [[‘h’;’e’;’l’;’l’;’o’];[‘w’;’o’;’r’;’l’;’d’]];; – : string list = [“hello”; “world”] Update If you want to suppress empty strings at the outer level you can do something like this: … Read more

[Solved] cout corrupt char* [closed]

You are passing a pointer to a local variable. Once your function ends, this variable is gone. If this is C++ you should use the string class. If for whatever reason you don’t, at least be const correct: const char* Worker::getName() const { return name; } 1 solved cout corrupt char* [closed]

[Solved] Convert an int** array into a char** array of a different size / composition [closed]

I think that you needed string, not 2D-Array. You can be written out to a string like write to the standard output by implementing a string that a simple extension. #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct char_vec { char *v; size_t capacity; size_t used; } sstream; sstream *ss_new(void); void ss_free(sstream *ss); void ss_putc(sstream … Read more

[Solved] Four 1byte char to One 4byte int? [closed]

Try following code: #include<iostream> #include<cstring> using namespace std; #define CHAR_ARRAY_SIZE 8 int main() { char charArray[CHAR_ARRAY_SIZE] = {‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’}; int intArray[2]; for(int i = 0; i < CHAR_ARRAY_SIZE/4; i++) { char ch1 = (charArray[4*i+0] – ‘0’); char ch2 = (charArray[4*i+1] – ‘0’); char ch3 = (charArray[4*i+2] – ‘0’); char … Read more