Information Computer

Thursday, January 5, 2012

Conversion Integer to String [QtCreator]

in the programming world is certainly very important variable. and the variable whose name is very close to the data type. in some programming language is very sensitive to the type of data.

in this post I discuss Integer and string data types. integer data type is a data type for data in the form of integers. while the string data type is a data type for data in the form of text. string data type could be worth number, but can not be calculated as arithmetic. therefore the data must first be converted to an Integer data type.

this time we try to convert the data type Integer to String and vice versa in QtCreator. follow the following steps.

1. The first example we created a variable of type int named number

int var_number = 6;

2. now convertible into QString way.
QString var_str_number= QString::number(var_number);

3. after that follows the example if you want to be converted again to the numbers.
int var_number_again = var_str_number.toint();

any question?? please comment above. good luck :)


need to know! 
Qt Creator is a cross-platform C++ integrated development environment which is part of the Qt SDK. It includes a visual debugger and an integrated GUI layout and forms designer. The editor's features includes syntax highlighting and autocompletion, but not tabs. Qt Creator uses the C++ compiler from the GNU Compiler Collection on Linux and FreeBSD. On Windows it can use MinGW or MSVC with the default install and can also use cdb when compiled from source.

Related Posts



0 comments:

Followers