saving . . . saved C PROGRAM has been deleted. C PROGRAM has been hidden .
C PROGRAM
Title
Question
HOW TO WRITE A PROGRAM

C-and-Cpp First-C-Program 11-12 min 50-60 sec 10-03-16, 11:09 a.m. sureshkundlas03@gmail.com

Answers:

Pls refer to the C/CPP series on http://spoken-tutorial.org/tutorial-search/?search_foss=C+and+Cpp&search_language=English to know how to write a C program.
You can also choose other languages like Hindi, Marathi, Gujarati, Assamese, Bengali, Tamil, etc.... to learn C/CPP from the same website.

Rgds,
Nancy Varkey
11-03-16, 1:21 a.m. nancy


To write a program, follow the steps:
1. Open the terminal on your system if using Ubuntu by pressing Ctrl+Alt+T.
2. Get the editor using the vim command.
3. Start the program using a single line comment(//). Double slash(//) is used as a single line comment. Comments are those statements which are not executed while running the program.
4. Start the program using the header files and the necessary requirements.
5. Start the main program. Every program requires a main function since execution of every function starts from the main function.
6. After performing the necessary actions, return the program to close the main function.
28-03-16, 8:34 p.m. sreelakshmi_r


Your steps provide a basic guide for writing a program using Vim in Ubuntu. Below is a structured version with additional clarity:

Steps to Write a Program in Ubuntu Using Vim:

1. Open the Terminal: Press Ctrl + Alt + T to open the terminal.


2. Open Vim Editor: Type vim filename.extension (e.g., vim program.cpp for a C++ program) and press Enter.


3. Write Comments: Begin the program with a comment using //. Comments help describe the code but are ignored during execution.


4. Include Header Files: Add necessary header files or libraries required for the program (e.g., #include <iostream> for C++ or #include <stdio.h> for C).


5. Define the Main Function: The program execution starts from the main() function. Example in C++:

#include <iostream> // Include necessary header file
using namespace std;

int main() {
    cout << "Hello, World!"; // Print message
    return 0; // Return to close the main function
}


6. Save and Exit Vim:

Press Esc, then type :wq and press Enter to save and exit.



7. Compile and Run the Program:

For C++: g++ program.cpp -o program && ./program

For C: gcc program.c -o program && ./program




Would you like steps for another language or a different editor?


24-03-25, 7:25 p.m. Kamleshkekan12@gmail.com


Log-in to answer to this question.