I am trying to concatenate the characters of a string but getting numerical value(s) instead. Why's that so?
C#
using System;
namespace std {
class Program {
static void Main(string[] args) {
string n = "helloWorld!";
Console.WriteLine(n[0] + n[1] + n[2] + n[3] + n[4] + n[5]);
}
}
}
C++
#include <iostream>
using namespace std;
int main() {
string x = "helloWorld!";
cout << x[0] + x[1] + x[2] + x[3] + x[4] + x[5] << endl;
return 0;
}
Output(Both languages) -
619
Expected Output -
helloW