Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Concept of c

Basic of C and C++ programming

  • Identifiez-vous pour voir les commentaires

  • Soyez le premier à aimer ceci

Concept of c

  1. 1. “Concept of C” Rohan K. Gajre
  2. 2. WAP To do addition of two Number but Declare One variable Yes it is possible in 3 different way in C and C++ programming Use function as well as Scope Resolution operator Function is block we call it n number of times Using Scope Resolution we use global values
  3. 3. 1 Using function int a; int add(); void main() { clrscr(); printf(“nt Addition 2 Number is %d”,add()+add()); getch(); } int add() { printf(“nt Enter Number”); scanf(“%d”,&a); return a; }
  4. 4. Description of First program In above program declare only one variable “a” and declare one function add() In printf() just calling function 2 times for addition. In function definition accepting values for variable a using scanf() and return values of a
  5. 5. 2 Scope Resoulation int x; void add(); void main() { clrscr(); add(); getch(); } void add() { cout<<“nt Enter Number”; cin>>::x>>x; x+=x+::x; cout<<x; }
  6. 6. Description of Second program In this program declare only one variable “x” declare one default function add() Using “cin” statement accepting value for X and scope value for same then doing addition and print result
  7. 7. 3 Function with return value int p; int add(); void main() { clrscr(); cout<<“nt Add is”<<add ()+add(); getch(); } int add() { cout<<“nt Enter Number”; cin>>p; return p; }
  8. 8. Description of Third program Third program is same like as first program only variable name is P instead of a.
  9. 9. Thank you!
  10. 10. Thank you!

×