I cannot find solution in the following problem

Asked By 10 points N/A Posted on -
qa-featured

#include<stdio.h>

void main(void)

{

printf("life is good"):

return 0:

}

Where is my problem?

please help me.

SHARE
Best Answer by Jack034
Best Answer
Best Answer
Answered By 0 points N/A #113326

I cannot find solution in the following problem

qa-featured

You have learn very difficult language of computer. C++ helps you to build many kinds of software. Learning C++ is difficult. You have describe a calculation. You have made some mistakes in your calculation.

***I am giving you the solution of your problem in the following:

In line 4 in printf you write : but that was ;

Like as printf(“life is good”);

Full solution

#include<stdio.h>

void main(void)

{

printf("life is good");

return 0:

}

I hope you have found the solution. You can try it. Just put this in your C++ and press F5

Answered By 0 points N/A #113327

I cannot find solution in the following problem

qa-featured

Proposed solution:

    #include <iostream>

    using namespace std;

    int main()

    {

           cout<<"life is good";

           return 0;

    }

In C++, The #include is a "preprocessor" directive that tells the compiler to put code from the header called iostream into our program before actually creating the executable. By including header files, you gain access to many different functions. For example, the "cout" and "cin" functions requires iostream. Following the include is the statement, "using namespace std;". This line tells the compiler to use a group of functions that are part of the standard library (std). By including this line at the top of a file, you allow the program to use functions such as "cout" and "cin". The semicolon is part of the syntax of C++. It tells the compiler that you're at the end of a command. You will see later that the semicolon is used to end most commands in C++.

The next important line is int main(). This line tells the compiler that there is a function named main, and that the function returns an integer, hence int. The "curly braces" ({ and }) signal the beginning and end of functions and other code blocks. You can think of them as meaning BEGIN and END.

The next line of the program may seem strange. If you have programmed in another language, you might expect that print would be the function used to display text. In C++, however, the cout object is used to display text (pronounced "C out"). It uses the << symbols, known as "insertion operators", to indicate what to output. cout<< results in a function call with the ensuing text as an argument to the function. The quotes tell the compiler that you want to output the literal string as-is.

Notice that the sentence ends with a semicolon character (;). This character signifies the end of the instruction and must be included after every instruction in any C++ program (one of the most common errors of C++ programmers is indeed to forget to include a semicolon ; at the end of each instruction).

Related Questions