Hi guys…
I want to write small program in C printing three or more people in array..how? please write to me the syntax as I am very poor in C..

How to define the name? and accept the conformation from the user? Either by yes or no

The printing should be like
Your name is (first name in array)
Your name is (second name in array)

Do you need to use Loop?

first, you need to write main() function

#include <stdio.h>

int main()
{

   // put your code here
}

next declare a character array that will hold the name that you input from the keyboard

#include <stdio.h>

int main()

{
   char name[80]; // allow up to 79 characters plus null terminator
   // put your code here
}

call printf() to display the prompt, and fgets() to get the input from the keyboard.

print("... < text goes here > ... ");
fgets(name,sizeof(name),stdin);

Hi Ancient,
Thanks for your help,
well, that slove first part of the probelm, i think i need to have a loop...

Assume, I have three elements in array – test[‘A’ , ‘B’ , ‘C’]

I want in the printf function to print this Question with each element

Are you Mr. A
Are you Mr, B
Are you Mr. C

Waiting your support
Thanks

I want in the printf function to print this Question with each element

Why use printf? Just use cout.
Also, why use a char array when the STL provides a string class?

If it's three or MORE people then use a vector since you don't know the exact size.

This article has been dead for over six months. Start a new discussion instead.