#2d array problem
15 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
I can only use for loop to fill in the item?
memset(array, 'X', sizeof(array));
Or
for (int i = 0; i < N; ++i) {
for (int j = 0; j < N; ++j) {
a[i][j] = 'X';
}
}
(we try to not just give the solution)
but yes - loop, memset, or some std:: options
I understand your stand
I am trying to ask question that is not exactly the same as my homework
and ask the method only
great 🙂
I want to do let the C++ know
a is same as A
my previous method is
char x;
cin>> x
if (x=='a' or x=='A') return true
do you have smarter method
I design to do this by using the table
by char x+32
then I dont need to do if (x=='a' or x=='A') until if (x=='z' or x=='Z')
however
can I do something like this?
@gleaming sage x=='a' or x=='A' is perfectly fine. You could to tolower(x) == 'a' if you want, but really either are fine.
you can access a char from the string with x[some index]
This question thread is being automatically closed. If your question is not answered feel free to bump the post or re-ask. Take a look at !howto ask for tips on improving your question.