Click here to Skip to main content
15,885,874 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi,could you give me a simple c example which program take input from user and display as you just entered sentences is: and display what user entered
Posted
Updated 8-Mar-12 8:42am
v2
Comments
Sergey Alexandrovich Kryukov 8-Mar-12 14:35pm    
I don't think many would be interested to write such a boring thing for you. It would be way more useful if you do it, ask a particular question if you get stuck.
--SA

 
Share this answer
 
You need:
  • A very basic understanding of the C programming language.
  • Knowing how fgets works (with stdin).
  • Knowing how printf works.


Reading a C programming book and a wise usage of Google would help you a lot.
 
Share this answer
 
v3
This is the whole module.

C#
using System;
using System.Runtime.InteropServices;

namespace ConsoleApplication1
{
  class Program
  {
    static void Main(string[] args)
    {
      Console.WriteLine("Enter text to display:");
      var input = Console.ReadLine();
      Console.WriteLine(input);
      //Last read line is just to make the console stay open
      Console.ReadLine();
    }
  }
}
 
Share this answer
 
Comments
CPallini 8-Mar-12 16:55pm    
Your C is a half tone too high.
Clifford Nelson 8-Mar-12 17:00pm    
Sorry. Missed the C. Are you working in Windows, or something else, You need to be specific. To interact with the OS for the reads and writes, it will depend on the technology.
CPallini 8-Mar-12 17:04pm    
Well, console I/O C code is pretty portable.
#realJSOP 9-Mar-12 7:21am    
We don't do people's homework for them because they won't learn anything if we do. If I'm going to be competing against these people for employment, I at least want them to know what they're doing when they accept the position for a fraction of a fraction of a fraction of my salary requirements.

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