Funkcijų naudojimas.

Slides:



Advertisements
Similar presentations
Lecture Computer Science I - Martin Hardwick Strings #include using namespace std; int main () { string word; cout
Advertisements

For(int i = 1; i
Pass by Value. COMP104 Pass by Value / Slide 2 Passing Parameters by Value * A function returns a single result (assuming the function is not a void function)
Factorial Preparatory Exercise #include using namespace std; double fact(double); int fact(int); int main(void) { const int n=20; ofstream my_file("results.txt");
Chapter 16 Exception Handling. What is Exception Handling? A method of handling errors that informs the user of the problem and prevents the program from.
Vectors, lists and queues
Inheritance (2).
Chapter 6 Advanced Function Features Pass by Value Pass by Reference Const parameters Overloaded functions.
Exercise 2.
Data Structures (Second Part) Lecture 2 : Pointers Bong-Soo Sohn Assistant Professor School of Computer Science and Engineering Chung-Ang University.
第三次小考. #include using namespace std; int aaa(int *ib,int a1,int a2) { int u,v; int m=(a1+a2)/2; if(a1==a2)return ib[a1]; u=aaa(ib,a1,m); cout
Chapter 8 Scope, Lifetime and More on Functions. Definitions Scope –The region of program code where it is legal to reference (use) an identifier Three.
C/c++ 4 Yeting Ge.
Tinaliah, S. Kom.. * * * * * * * * * * * * * * * * * #include using namespace std; void main () { for (int i = 1; i
Triana Elizabeth, S.Kom. #include using namespace std; void main () { for (int i = 1; i
Darbas su failais Arnas Terekas IT 1gr. Vilniaus universitetas Matematikos ir informatikos fakultetas.
Functions Pass by Reference Alina Solovyova-Vincent Department of Computer Science & Engineering University of Nevada, Reno Fall 2005.
Tracing through E01, question 9 – step 1 // p02.cc P. Conrad, for CISC181 07S // Exam question for E01 #include using namespace std; void mysteryFunction(int.
Free Phone $25 a month 100 minutes then 35c per min Free Phone $25 a month 100 minutes then 35c per min Free Phone $20 a month 75 minutes then 25c per.
CSE 1341 Honors Note Set 2 1. Overview  Java vs. C++  Functions in C++  First Programming Packet  Development Environment 2.
File Handling in C++.
Print Row Function void PrintRow(float x[ ][4],int i) { int j; for(j=0;j
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
C++ : Operator overloading example
Type conversion RITIKA SHARMA.
Overloaded Constructors and Multiple Classes
File Processing in C++ Data is stored in files so that it may be retrieved for processing when needed.
#define #include<iostream> using namespace std; #define GO
using System; namespace Demo01 { class Program
Command Line Arguments
Floating Point Values Internally, floating point numbers have three pairs: a sign (positive or negative), a mantissa (has a fixed number of digits) and.
Lab Session-9 CSIT-121 Spring 2005
לולאות קרן כליף.
Polymorphism Lec
Lecture 4-7 Classes and Objects
Dynamic Memory Allocation Reference Variables
Function Basics.
Random Number Generation
פונקציות לעיתים קרובות לא נוח להגדיר את כל התוכנה בתוך גוף אחד.
DSP Lab. Week 1 Drawing sinusoidal waves
More About File Reading
אבני היסוד של תוכנית ב- C++
Programming -2 برمجة -2 المحاضرة-7 Lecture-7.
הרצאה 03 אבני היסוד של תוכנית ב- C
Starting Out with C++: From Control Structures through Objects
Pointers & Functions.
Anatomy of a Function Part 1
Code::Block vs Visual C++
15 seconds left 30 seconds left 3 minutes left 2 minutes left 1 minute
Introduction to Programming
File Processing in C++ Data is stored in files so that it may be retrieved for processing when needed.
CS1201: Programming Language 2
Arrays of Two-Dimensions
Passing Arrays to functions
CHAPTER 2 Arrays and Vectors.
Glenn Stevenson CSIS 113A MSJC
CHAPTER 4 File Processing.
foo.h #ifndef _FOO #define _FOO template <class T> class foo{
CHAPTER 2 Arrays and Vectors.
რეკურსიული პროგრამირება
Inline Functions.
Introduction to Algorithms and Programming
Pointers & Functions.
Anatomy of a Function Part 1
Introduction to Algorithms and Programming
Introduction to Algorithms and Programming COMP151
File I/O in C++ II.
Lecture 9 Files Handling
Introduction to Algorithms and Programming COMP151
CSE Module 1 A Programming Primer
Presentation transcript:

Funkcijų naudojimas

#include<iostream> using namespace std; void reading (int &n, i float nt a[]); void writing (int n, float a[]); void scaling (int n, float a[], float &b); int main () { int n; float a[20], b; reading (n, a); writing (n, a); scaling (n, a, b); } //============================== void reading (int &n, float a[]) {} void writing (int n, float a[]) void scaling (int n, float a[], float &b)

Funkcija su parametrais-nuorodomis

#include <iostream> #include <fstream> using namespace std; void reading (int &n, int time_start[], int time[]); //duomenų skaitymas iš tekstinio failo void minutes (int t1, int t2, int &t); //duomenų konvertavimas minutėmis void period (int n, int time_start[], int time[], int time_end[]); //duomenų skaičiavimas void writing (int n, int time_end[]); //duomenų spausdinimas void minutes2 (int &t1, int &t2, int t); //duomenų konvertavimas val. ir min. int main () { int n; int time_start[20]; int time[20]; int time_end[20]; reading (n, time_start, time); period (n, time_start, time, time_end); writing (n, time_end); } //============================== void reading (int &n, int time_start[], int time[]) {} void minutes (int t1, int t2, int &t) void period (int n, int time_start[], int time[], int time_end[]) void minutes2 (int &t1, int &t2, int t) void writing (int n, int time_end[])

Funkcija su parametrais-nuorodomis

Funkcija su parametrais-nuorodomis

Funkcija, grąžinanti apskaičuotą reikšmę per funkcijos vardą