আমি মনে করি আমার কোড ঠিক আছে, কিন্ত কাজ করে না। ‌__** লিখলে প্রিন্ট হয় <i>_<b>*

Problem
Code

asked 06 Feb, 11:38

pollob1563's gravatar image

pollob1563
2178

edited 07 Feb, 04:17

কোডের লিংক ভুল। এই কোডটি অন্য এক সমস্যার।

(06 Feb, 12:20) Mosharraf Hosain ♦

ঠিক করেছি ।

(06 Feb, 13:06) pollob1563

str.erase() বাদ দিলেই হয়।

bool uscore = true, star = true;
for (int i = 0; i < str.size(); i++) {
    if (str[i] == '_' and uscore) {
        cout << "<i>";
        uscore = false;
    } else if (str[i] == '_' and not uscore) {
        cout << "</i>";
        uscore = true;
    } else if (str[i] == '*' and star) {
        cout << "<b>";
        star = false;
    } else if (str[i] == '*' and not star) {
        cout << "</b>";
        star = true;
    } else cout << str[i];
}
cout << endl;
permanent link

answered 08 Feb, 17:33

Mosharraf%20Hosain's gravatar image

Mosharraf Hosain ♦
75618

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×58
×8

question asked: 06 Feb, 11:38

question was seen: 108 times

last updated: 08 Feb, 17:33