Hello
i'm working on a project in c++ that convert a text to a language that i want and display the result example : " string x; if (x= "a") { printf("%");}"
Thanks :) please help me ...
What is your problem exactly? I assume what you wrote above is just pseudo-code. Also, the string comparison would be if(x=="a"), and printf would also need the argument list for what you want to sub in for your %? statements.
actually i wrote it in vb.net anyway
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
if textbox1.text = "a" then
textbox2.text = "2"
else textbox1.text = "b" then
textbox2.text = "3"
....the same code.....
end if
End Sub
Are you looking to make this a graphical application, or something that runs on a command line? Graphical might be a bit more involved, and you will almost certainly need to use a visual editor.
In C++, text can be handled in a few ways. The most common, and easiest to deal with these days is the string class.
That will run a very simple program reading in a string of text from the user, checking it against the word "Hello", then if it matches, it will print the string "1bcae".
You can add more of those if checks down the list, but the program will not break apart the string. If a user enters a sentence for instance, it will check the entire sentence against a word. If you want it to break the sentence apart into each word, and check each of them, the program will get a bit more involved. You will then need to find the break points in your string (spaces, tabs...) and use the substr function to extract the "words" one at a time from the sentence, then compare those to your list of converted words in a loop (most likely a while loop).