Академический Документы
Профессиональный Документы
Культура Документы
online, click
compiler . .
Install
compiler
program (execution)
program
===Windows ===
. (Start -> All Programs -> Dev-C++) ( "Tip of the Day" tips program . . ) window )
New
Source File .
Namaskar.
1. 2. program
. C .
. .
cd command .
4 command
. pwd : current 4.
gcc namaskar.c
Enter
compile 5 . Run
./a.out
. .
error
namaskar
==============
. .
Run
program (comment ) ,
Run
. C/C++ program
error :
!!
screen line
Namaskar
program
. C printf screen
. 3 line .
line
program }
program run
function
function
program compile In function `int main()': error: expected `;' before "scanf" Execution terminated scanf ; . function . ; .
error
, compile
compile
program printf
compile compile .
program , interest(
calculation
Share
Index Next Hindi C/C++ programming language tutorial variables expressions . variables in C/C++ programming language Variable , variable define C/C++ program ?
1 2#include <stdio.h> int main() { 3 int x; 4 x = 1; 5 x = 5; 6 scanf("%s"); 7 return 1; 8} 9
. define .
variable use
. .
printf .
1. int
main() {
variable define
int
integer
. integer ( 2. x
= 1;
temp
variable define
variable x x 1
C/C++ program
line x
. 5
line .
variable define
program set
3 variable: price, rate, time define . variable interest define interest variable (interest) .* value (division).
value
(multiplication) /
?
1price*rate*time/100;
150 ()
interest
value 150
print .
(printf
) .
topic
printf(""); ""
line . printf("Value is %d", 8); screen print Value is 8 printf function 2 input parameter paremeter print ?
1 #include <stdio.h> 2 3 int main() { int price; 4 int rate ; 5 int time; 6 1000; 7 price==5; rate 8 time = 3; 9 10 int interest; 11 interest = price*rate*time/100; 12 printf("Price is %d, Rate is %d, 13price, rate, time, interest); 14 15 scanf("%s");
parameter %d %d ,
1st value .
value print
16 } 17 18 19
return 1;
program print Price is 1000, Rate is 5, time is 3, calculated interest is 150 1st parameter %d , paremeter integer ( . ) !! type link Share variable . .
+, - *
operators
facebook twitter Google Buzz Hindi variables expressions C/C++ hindi tutorial 1. Compiler terminal Windows ! C . main 2. main() function . printf() function terminal print expressions ! C/C++ . compile . a.out
language
expression printf .
3. Variable declare datatype, . (allocate) variables value value computer . 1 .. bits . bits 0 store . declare . . (value),
10 .
int x; define
declare value ,
variable compiler x
(desirable)
execute
address
datatypes
1. int -
2,147,483,648 .
2,147,483,647 (range)
value store
1.2, .002 .
(character number
. ASCII table
Computer
datatypes 4. double . 5. short int int 6. long int machine int int 4 byte float
(variant)
memory memory
32 bit architecture (
! replace
code
int
? code
#include <stdio.h> int main() { float price; float rate ; float time; price = 1000.0 ; rate = 5.3; time = 3.5; float interest; interest = price*rate*time/100.0; printf("Price is %f, Rate is %f, time is %f, calculated interest is %f", price, rate, time, interest); scanf("%s"); return 1; }
, %d int print
printf %d
%f %f float value
Note:
C/C++ program
. Hindi ( ,
if-else statement
output
output false
== : compare
operator == format
variable value
compare
value .
variable if else .
if statement
if(boolean expression1) { statement1; } else if(boolean expression2) { statement2; } ..... .... .... else { statementN; } boolean expression expression1 expression1 true true false value true false. boolean .
. boolean .
statement2 execute ,
true
statement
execute
percent
example
percent
#include <stdio.h> int main() { int total_marks = 500; int obtained_marks = 272; int percent = obtained_marks*100/total_marks; if(percent >= 60) { printf("Congrats!! You passed in 1st division.\n"); printf("Your percentage is %d.\n",percent); } else if(percent >= 45) { printf("You passed in 2nd
division.\n"); printf("Your percentage is %d.\n",percent); } else if(percent >= 33) { printf("You just passed in 3rd division.\n"); printf("Your percentage is %d.\n",percent); } else { printf("Sorry! you failed.\n"); printf("Your percentage is %d.\n",percent); } scanf("%s"); return 1; }
program
values int
.)
value 54
.(
true
print \n \n
statement . \n run .
line print
C/C++ program
topic if else
!! link Share
example .
Hindi if else
#include <stdio.h> int main() { int percent = 45; if(percent >= 33) { printf("Congrats!! You passed.\n"); } else { printf("Sorry.! you failed\n"); } scanf("%s"); return 1; }
run
example percent .
check
(else)
{}
speed
60
#include <stdio.h> int main() { int speed = 65; if(speed > 60) { printf("Warning: Speed is in danger zone.\n"); } else { } scanf("%s"); return 1; }
speed
value
program run
. speed 60 program
#include <stdio.h> int main() { int speed = 65; if(speed > 60) { printf("Warning: Speed is in danger zone.\n"); } scanf("%s"); return 1; }
else
program
else . Share . .