Testi3xiii2 Z 2014

You might also like

You are on page 1of 2

Testi3 Gjuh programuese Kl XII2(XIII2)

Shkolla mesme profesionale


"Feriz Guri dhe Vllezrit aka"
Kaanik

Emri................................ Mbiemri ..................................... Nr...........
Kaanik Arsimtari i lnds
25(28)/03/2014 Ismail Dashi


1A. far do t jet dalja e programit n C++

#include <iostream>
using namespace std;
double siperfaqja(float a, float b);
int main( )
{
float a=2,b=10;
double s;
s=siperfaqja(a,b);
cout << " s=" << s<<endl;
s=siperfaqja(3,4);
cout << " s=" << s<<endl;
system ("pause");
}
double siperfaqja(float a,float b)
{
double z;
z=a*b;
return z;
}
2A. far do t jet dalja e programit n C++( shkruaj
rezultatin n menjher n koment)
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
float a=2, b=4, c=-1;
cout<<pow(a,b)<<endl; // 16
cout<<abs(c)<<endl; //1
cout<<exp(a+c)<<endl;//2.71828 ~(e)
cout<<log10(b+6)<<endl;// 1
cout<<(57.3*acos(0.5));//60
o

system ("pause");
return 0;
}
3A
Shkrruani programin kryesor pr llogaritjen e vlers
numerike e shprehjes
y=
_
1 +

x +2_
x
2
1+x
3
4

nse sht dhn x=2.0. Rekomandohet q e tr shprehja
t ndahet t pjes-n rreshta veant t programit.
Zgjidhje:
y=( 1 +x +2(
x
2
1+x
)
1/3
)
1/4


int main()
{
double x=2.0, y, a, b, c, d;
a=1+sqrt(x);
b=pow(x, 0.666666);
c=pow (1+x, 0.3333333);
d=b/c;
y=a+2*d;
y=pow(y, 0.25);
cout<<"Rezultati sht "<<y<<endl;
system ("pause");
return 0;
}
y=( 1 +

x +2(
x
2
3
(1+x)
13
))
1/4


y=( 1 +

x +2(
x
.
(1+x)
.333333
))
0.25
tani e shkruajm kodin:

#include <iostream>
using namespace std;
#include <cmath>

4A.
A) Shkruani funksionin pr testim t karaktereve
nse sht karakter i kontrollit(Kodet ASCII
0..31 dhe 127)
int iscntrl(int ch);
.................................................
B) Shkruani funksionet pr testimin e karaktereve,
nse karakteri sht shifr(0..9)
int isdigit(int ch);
.................................................
C) Shkruani funksionet pr ndryshimin t
shkronjave t vogla n t mdha
int toupper (int ch);
.................................................


s=20
s=12


Testi3 Gjuh programuese Kl XII2(XIII2)


Shkolla mesme profesionale
"Feriz Guri dhe Vllezrit aka"
Kaanik

Emri................................ Mbiemri ..................................... Nr...........
Kaanik Arsimtari i lnds
25(28)/03/2014 Ismail Dashi


1B. far do t jet dalja e programit n C++
#include <iostream>
using namespace std;
double perimetri(float r);
int main(){
float r=4;
double p;
p= perimetri (r);
cout << " p=" << p<<endl;
p= perimetri (3);
cout << " p=" << p<<endl;
system ("pause");
}
double perimetri (float r){
double z;
z=2*3.14*r;
return z;
}
2B. far do t jet dalja e programit n C++( shkruaj
rezultatin menjher n koment)
#include <iostream>
#include <cmath>
using namespace std;
int main( )
{
float a=2, b=4, c=-1;
cout<<pow(3.0, 2.0)<<endl;//9
cout<<sqrt(b)<<endl;//2
cout<<abs(c)<<endl; //1
cout<<exp(a+c)<<endl;//2.71828
cout<<log(a+c)<<endl;//0
cout<<cos(30/57.3) <<endl;//0.866045
cout<<(57.3*asin(0.5));//30
o

system ("pause");
return 0;
}
3B
Shkrruani programin kryesor pr llogaritjen e vlers
numerike e shprehjes
y=
_
1 +x +
_
1+x
1+x
2
3
S

nse sht dhn x=2.3. Rekomandohet q e tr shprehja
t ndahet t pjes-n rreshta veant t programit.
Zgjidhje:

y=( 1 +x +(
1+x
1+x
2
)
1/3
)
1/5

y=( 1 +x +
(1+x )
.333333
(1+x
2
)
.3333
)
0.2


int main() {
double x, y, a, b, c, d;
x=2.3;
a=1+x;
b=1+ sqrt(x);
b=pow(b, 0.333333);
c=pow (x,2.0);
c=1+c;
c=pow (c, 0.33333);
d=b/d;
y=a+d;
y=pow(y, 0.2);
cout<<"Rezultati sht "<<y<<endl;
system ("pause");
return 0;
}

#include <iostream>
using namespace std;
#include <cstdlib>
#include <cmath>
4B. Shkruani funksionin pr testim t karaktereve nse
sht karakter i kontrollit(Kodet ASCII 0..31 dhe 127)
int isdigit(int ch);
.................................................
A) Shkruani funksionet pr testimin e karaktereve,
nse karakteri sht numr heksadecimal,
0-F
int isxdigit(int ch);
.................................................
B) Shkruani funksionet pr ndryshimin t
shkronjave t mdha n t vogla
int tolower (int ch);
.................................................

p=25.12
p=18.84

You might also like