Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How would I set up a for loop to print "Hello my name is:" Then display the name of each speaker in the array? So when I run the program it would say

ie
"hello, my name is ..."
"hello, my name is ..."
"hello, my name is ..."
"hello, my name is ..."
"hello, my name is ..."
"hello, my name is ..."



Attached is a picture of what I have so far.It's a start...
Thank you so much in advance.
Posted
Comments
Sergey Alexandrovich Kryukov 2-Apr-15 19:24pm    
Picture? Please don't do it? Code — in a picture. What's you logic?
—SA

1 solution

This should do your job-
C++
for ( i = 0; i < sizeof(names); i++ )
{
   printf("hello, my name is " + names[i] + "\n"); //names[] is the array containing speaker names
}

Hope, it helps :)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900