This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int suma(int n) | |
{ | |
if(n==0) | |
return 0; //conditia de oprire (nu are sens sa mergem mai departe de 0) | |
else | |
return n+suma(n-1); //formula de recurenta | |
} | |
int n; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void mesaj() //antetul subprogramului/functiei | |
{ | |
cout<<"Salut!"; //afisare "Salut!" pe ecran | |
mesaj(); //autoapelare | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
using namespace std; | |
int main() { | |
ifstream f("numere.in"); | |
int n, x, count = 0; | |
f >> n; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string.h> | |
using namespace std; | |
int main() { | |
int i, n, x, a[100], pos = 0, exista_mari = 0, exista_mici = 0; | |
cin >> n >> x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
using namespace std; | |
int main() { | |
ifstream f("numere.in"); | |
int n, x, count = 0; | |
f >> n; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string.h> | |
using namespace std; | |
int main() { | |
int n, no_words = 0, i, exista_mari = 0, exista_mici = 0; | |
char text[101], words[100][100], *p; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
void duplicare(int n, int &d) { | |
int p = 1, are_cifre_impare = 0; | |
d = 0; | |
while (n > 0) { | |
int ultima_cifra = n % 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
int i, a[5][7]; | |
/* | |
* inainte de secventa ceruta se poate citi matricea | |
* in acest moment, fara alte instructiuni, | |
* matricea contine elemente fara sens |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
using namespace std; | |
int main() { | |
ifstream f("bac.txt"); | |
int a, maxim = -1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
int n, i, a[21]; | |
cin >> n; | |
for (i = 0; i < n; i++) |
NewerOlder