Array
-
Hi All I am new student to MCA.I need some example of Array.How can i store a Char type values in store and print.Plz help me
-
'Array' as such doesn't exist in C++. There are some stl containers such as std::vector, std::list and the C-style array. Please try to be more specific in your question.
-- Arman
-
Hi All I am new student to MCA.I need some example of Array.How can i store a Char type values in store and print.Plz help me
-
Hi All I am new student to MCA.I need some example of Array.How can i store a Char type values in store and print.Plz help me
If you are looking for a simple c++ program to store character strings in a character array and print them, then have a look at the follwowing piece of code : void main() { char see[3][256] = {"\0" }; for (int nCntr = 0; nCntr < 3; nCntr++) sprintf (see[nCntr], "%d", nCntr); for (int nCntr = 0; nCntr < 3; nCntr++) printf ("\n%s", see[nCntr]); } Is that what you wanted??
-
I recommend you get some good book for 'C'. Your are MCA student so i think you are from India. If yes,Please have a look at "Let us C" this is very good for beginners. There are other good books also like "Schaum's Series" etc.
Regards, Sandip.
-
ok i have
char see[3]='*';
and i want to store thesesee
values and print one by one.. Plz help meint main(){ char see[3]; see[0] = 's'; see[1] = 'e'; see[2] = 'e'; // or you can do above 3 steps in loop also for (int a=0; a<3; a++) { cout<<"enter a character:"; cin>>see[i]; } for(int i=0; i<3; i++) { cout<<see[i]; } return 0; } Try this and start with any of book suggested by sandip.
-
Hi All I am new student to MCA.I need some example of Array.How can i store a Char type values in store and print.Plz help me
For instance:
char myCharArray[]={ 'a', 'b', 'c', 'd', 'e'};
char c = myCharArray[3]; // now c value is 'd'BTW Good
C
tutorial needed. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Hi All I am new student to MCA.I need some example of Array.How can i store a Char type values in store and print.Plz help me
rdop wrote:
I am new student to MCA.
Unless you have 0 experience with the C language, a person pursuing a Master's degree, especially in a computer-related field, should easily be able to find this with minimal effort.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
-
If you are looking for a simple c++ program to store character strings in a character array and print them, then have a look at the follwowing piece of code : void main() { char see[3][256] = {"\0" }; for (int nCntr = 0; nCntr < 3; nCntr++) sprintf (see[nCntr], "%d", nCntr); for (int nCntr = 0; nCntr < 3; nCntr++) printf ("\n%s", see[nCntr]); } Is that what you wanted??
raesa wrote:
If you are looking for a simple c++ program...then have a look at the follwowing piece of code :
What part of your code is C++? :confused:
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
-
raesa wrote:
If you are looking for a simple c++ program...then have a look at the follwowing piece of code :
What part of your code is C++? :confused:
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch