C++ arrays and characters is starting to get more difficult as I read on a book, which teaches C++ programming. Can anyone give me some advice on how to learn it?
This is a discussion on C++ arrays and characters within the C++ Programming forums, part of the General Programming Boards category; C++ arrays and characters is starting to get more difficult as I read on a book, which teaches C++ programming. ...
C++ arrays and characters is starting to get more difficult as I read on a book, which teaches C++ programming. Can anyone give me some advice on how to learn it?
Click on ads and get paid! + advice on getting free referrals
Great and reliable Paid to click websites || View Ads and get paid || Get advice on how to get free referrals.
It's a tough subject for anyone just now starting to learn the language. Keep reading slowly, always doing more exercises than what the book suggests, and exploring new things without fearing compiler errors. What's the book?
Originally Posted by brewbuck:
Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.
How early are you in your learning? Have you learned about C++ strings yet?
I would actually suggest you hold off on learning character arrays until you've spent time learning about arrays in general, which should be after you have done a lot of beginning C++ work. It should certainly be after you have learned how to use the C++ string class.
If you want to follow your book and your book teaches character arrays (also known as C-style strings), then my only advice would be to go over that section of your book a few times and read tutorials on the internet about it. If you get stuck on specific problems we can probably explain them here.
I've learnt about the string class. I think you mean the #string...right? Ok, anyways, I'm reading a book...published by...Orsborn. The author of the book is by John Smiley. The title is Learn to program with C++. The book is kind of...outdated...but not exactly outdated. Its meant for windows 2000 actually..or maybe even 98..lol
Click on ads and get paid! + advice on getting free referrals
Great and reliable Paid to click websites || View Ads and get paid || Get advice on how to get free referrals.
>> I think you mean the #string
I've never heard of #string, but we still might be talking about the same thing:If you know that kind of string, great. Do you know arrays in general? A C style string is implemented with an array of characters that has the special property having one extra element to mark the end of the array (C style arrays don't keep track of their own size). So if you know arrays in general that's a good step.Code:#include <iostream> #include <string> int main() { std::string first_name; std::cout << "What's your first name? "; std::cin >> first_name; std::cout << "Hello, " << first_name; }
Do you have any specific questions that prompted this thread?
I hope this will help you as it helped me:
http://www.cplusplus.com/doc/tutorial/ntcs.html