Sei sulla pagina 1di 8

#include <cstdlib>

#include <iostream>

using namespace std;

int main(int argc, char *argv[])

float a11, a12, a21, a22, b1, b2, det, detx, dety;

printf("Vnesete gi koeficientite za ravenkata a11x+a12y=b1, a11, a12, b1 : ");

scanf("%f, %f, %f", &a11, &a12, &b1);

printf("Vnesete vi koeficientite za ravenkata a21x+a22y=b2, a21, a22, b2 : ");

scanf("%f, %f, %f", &a21, &a22, &b2);

det=(a11*a22)-(a21*a12);

detx=(b1*a22)-(b2*a12);

dety=(a11*b2)-(a21*b1);

if(det==0&&detx==0&&dety==0)

printf("Sistemot ima beskonecno mnogu resenija.");

else if(det==0&&(detx!=0||dety!=0))

printf("Sistemot nema resenie.");

else

printf("Resenieto na sistemot na ravenki e: x1= %.2f y= %.2f . \n",(detx/det), (dety/det));

system("PAUSE");

return EXIT_SUCCESS;

}
#include <cstdlib>

#include <iostream>

//Paskalov trijagolnik

using namespace std;

int Paskalov(int x, int y)

if(y==1 || x==y)

return 1;

else

return Paskalov(x-1,x)+Paskalov(x-1, y-1);

int main(int argc, char *argv[])

int i, j, z;

printf("Vnesi kolku redovi da ima paskaloviot triagolnik: ");

scanf("%d", &z);

for(i=1;i<=z;i++)

for(j=1;j<=i;j++)

printf("%d ", Paskalov(i,j));

printf("\n");

system("PAUSE");

return EXIT_SUCCESS;

}
#include <cstdlib>

#include <iostream>

//Fibonacieva niza

using namespace std;

int main(int argc, char *argv[])

long granica, f0=0, f1=1, f2; //Ako f2 e long togas bideki f1=f2, a f0=f1 bi trebalo site long da bidat

cout<<"Vnesete do koj broj ke bide granicata na nizata: ";

cin>>granica;

cout<<"Broevite na Fibonaci do granicata "<<granica<<" se:\n0,\n";

while(true)

f2=f0+f1;

if(f2>granica) break;

cout<<f2<<", \n";

f0=f1;

f1=f2;

system("PAUSE");

return EXIT_SUCCESS;

#include <cstdlib>

#include <iostream>
//Smena na vrednosti

using namespace std;

void swap(int* x, int* y);

int main()

int x=5, y=10;

cout<<"Vrednosti na x i y pred koritenje na funkcijata swap(): \n";

cout<<"x="<<x<<endl;

cout<<"y="<<y<<endl;

cout<<endl;

swap(x,y);

cout<<"Vrednosti na x i y po koristenje na funkcijata swap():\n";

cout<<"x="<<x<<endl;

cout<<"y="<<y<<endl;

cout<<endl;

system("PAUSE");

return EXIT_SUCCESS;

void swap(int* pokx, int* poky)

int temp;

temp = *pokx;

*pokx = *poky;
*poky = temp;

#include <cstdlib>

#include <iostream>

//Smena na vrednosti niza

using namespace std;

int main()

int A[10];

int *pokpoc=&A[0];

int *pokkr=&A[9];

int i;

cout<<"Vnesete 10 broevi vo nizata: \n";

for(i=0;i<=9;i++)

cin>>*(A+i);

for(i=0;i<10/2;i++)

int temp=*pokpoc;

*pokpoc=*pokkr;

*pokkr=temp;

cout<<*pokpoc<<endl;

cout<<*pokkr<<endl;

pokpoc++;

pokkr--;
}

system("PAUSE");

return EXIT_SUCCESS;

#include <cstdlib>

#include <iostream>

#include <string>

//Pokazuvaci na string 1

using namespace std;

int main()

char pole[100];

strcpy(pole,"Programiranje vo C++");

char* pokpol=&pole[0];

cout<<"pole: "<<pole<<endl;

cout<<"pokpol: "<<pokpol<<endl;

cout<<"*pokpol: "<<*pokpol<<endl;

cout<<"adresa na pokpol: "<< int(pokpol)<<endl;

pokpol+=15;

cout<<"pole: "<<pole<<endl;

cout<<"pokpol: "<<pokpol<<endl;

cout<<"*pokpol: "<<*pokpol<<endl;

cout<<"adresa na pokpol: "<< int(pokpol)<<endl;


system("PAUSE");

return EXIT_SUCCESS;

#include <cstdlib>

#include <iostream>

#include <string>

//Pokazuvaci na string 1

using namespace std;

int main()

char pole[100];

strcpy(pole,"Programiranje vo C++");

char* pokpol=&pole[0];

cout<<"pole: "<<pole<<endl;

cout<<"pokpol: "<<pokpol<<endl;

cout<<"*pokpol: "<<*pokpol<<endl;

cout<<"adresa na pokpol: "<< int(pokpol)<<endl;

pokpol+=15;

cout<<"pole: "<<pole<<endl;

cout<<"pokpol: "<<pokpol<<endl;

cout<<"*pokpol: "<<*pokpol<<endl;

cout<<"adresa na pokpol: "<< int(pokpol)<<endl;

system("PAUSE");
return EXIT_SUCCESS;

}//ova da se proba so reden broj na bukva da se najdi na proizvolen string

Potrebbero piacerti anche