Dev C++ Sample Program Codes

C: If and Else Statements. Bo burnham tour. So we've learnt how to collect basic data from the user, but wouldn't it be useful if we could do different things depending on what the user typed in? Well this happens to be a very core concept of computer programming, and we can do exactly as previously described with these things called 'if' statements. C Basic Example Programs. Hello World C Example Program; Simple Program for Read user Input Using cin; Simple Addition ( Add Two Integers ) Example Program; if Statement Example Program in C; if.else Statement Example Program In C; If Else Ladder Example Program; Simple Switch Statement Example Program In C; For Loop Example Program.

Dev C++ Example Program Codes Pdf

C++ class program example: In our program, we create a class named programming with one variable and two functions. In the main function, we create an object of this class and call these functions.

C++ programming code

#include<iostream>

Dev C++ Pdf

usingnamespace std;

class programming
{
private:
int variable;
public:
void input_value()
{
cout<<'In function input_value, Enter an integern';
cin>> variable;
}
void output_value()
{
cout<<'Variable entered is ';
cout<< variable <<'n';
}
};

main()
{
programming object;
object.input_value();
object.output_value();
//object.variable; Will produce an error because variable is private
return0;
}