i have a few questions.: 1)if i wanted to write a line of code needed to declare a 1-dimensional array named names that can hold 8 string values would this be correct?: char names[8];
2)how would i write the code needed to assign strings to each element of the array names from question 1) above? how would i use a loop to ask the user for the name & assign it to the element?
3)if i wanted to write the line of code needed to declare a vector named myList that can initially hold 5 integer values would this be correct?
vector<int> myList(5);
4)how would i write the line of code to assign 18 to the 6th element of the myList vector from question 3) above...that is 1 past the initial number of elements set for myList?
eternaloptimist
-4
Newbie Poster
Recommended Answers
Jump to Post>> 1)if i wanted to write a line of code needed to declare a 1-dimensional array named names that can hold 8 string values would this be correct?: char names[8];
Nope what you declared is an array of chars. chars are just 1 character. For example 'a' is a …
Jump to Post>>[edit]wow...i'm slow....[/edit]
Yep. We are super ninjas.
All 7 Replies
mrnutty
761
Senior Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
Nick Evan
4,005
Industrious Poster
Team Colleague
Featured Poster
Fbody
682
Posting Maven
Featured Poster
mrnutty
761
Senior Poster
Nick Evan
commented:
We are indeed :)
+12
eternaloptimist
-4
Newbie Poster
eternaloptimist
-4
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.