Search Results

Search found 4 results on 1 pages for 'danutenshu'.

Page 1/1 | 1 

  • Specifying character

    - by danutenshu
    So below I have a code in C++ that is supposed to invert the arguments in a vector, but not the sequence. I have listed my problems as sidenotes in the code below. The invert function is supposed to invert each argument, and then the main function just outputs the inverted words in same order For instance, program("one two three four")=ruof eerth owt eno #include <iostream> #include <string> using namespace std; int invert(string normal) { string inverted; for (int num=normal.size()-1; num>=0; num--) { inverted.append(normal[num]); //I don't know how to get each character //I need another command for append } return **inverted**; <---- } int main(int argc, char* argv[]) { string text; for (int a=1; a<argc; a++) { text.append(invert(argv[a])); //Can't run the invert function text.append(" "); } cout << text << endl; return 0; }

    Read the article

  • Why is this c++ string concatenation missing a space?

    - by danutenshu
    I am working with c++ strings, and am a beginner at programming. I am expecting: 99 Red Balloons But I am receiving: 99 RedBalloons Why is that? #include <string> #include <iostream> using namespace std; int main() { string text = "9"; string term( "9 "); string info = "Toys"; string color; char hue[4] = {'R','e','d','\0'}; color = hue; info = "Balloons"; text += (term + color + info); cout << endl << text << endl; return 0; }

    Read the article

  • Printing escape character

    - by danutenshu
    When I am given "d""\"/""b", I need to print out the statement character for character. (d, b, a slash, a backslash, and 5 quotes) in C++. The only errors that show now are the lines if(i.at(j)="\\") and else if(i.at(j)="\""). Also, how should the outside double apostrophes be excluded? #include <iostream> #include <cstdlib> using namespace std; int main (int argc, const char* argv[] ) { string i= argv[1]; for (int j=0; j>=sizeof(i)-1; j++) { if(i.at(j)="\\") { cout << "\\"; } else if(i.at(j)="\"") { cout << "\""; } else { cout << i.at(j); } } return 0; }

    Read the article

  • How to run multiple arguments in Cygwin

    - by danutenshu
    I've been trying to run a program that will invert the order of a string and to run it, I have to type a second argument in prompt. int main(int argc, char* argv[]) { string text = argv[2]; for (int num=text.size(); num>./0; num--) { cout << text.at(num); } return 0; } e.g. ./program lorem result: merol

    Read the article

1