English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

im really get confused abt something....In C++, What is the use of ((const int i=5))..I need to know the use const??!
Can u explain more in how to use strings? and when??

2007-10-10 20:43:08 · 4 answers · asked by David Junior 3 in Computers & Internet Programming & Design

4 answers

const stands for constant. so the value of the variable declared as const remains constant throughout the program i.e. 5 here.

in c++, there is separate string class. u can use the c strings.

so c string is char c[] = "my string";

c++ string is String c = "my string";

2007-10-10 21:20:45 · answer #1 · answered by Anonymous · 0 0

const int i=5 menace i is 5 thought the program until you can not modified it.
In C++ there is not any string data type. So you can use a string by declaring character array. like
char s[20];
gets(s);
put(s);
with the help of this you can declare a string, input it & and print it.
If you want to seprate each character from string then you use for loop
like
for(i=0;s[i]!='\0';i++)
putchar(s[i]);

Other wise you can use string function directly.
I think that is suffisient for you. If any other dificulty then ask again.

2007-10-11 04:52:54 · answer #2 · answered by adraut1 1 · 0 0

const is short for constant. A constant integer cannot be modified once it is defined. In this case, i will always be 5 throughout the program.

2007-10-11 03:46:57 · answer #3 · answered by rath 5 · 0 0

I know little about Programming & Design...... though I loved computers very much, I still chose Bussiness Administration as my major following my father's advice.

2007-10-11 04:51:44 · answer #4 · answered by peterpan 1 · 0 0

fedest.com, questions and answers