cum se poate rezolva asta in c++?
Răspunsuri la întrebare
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
void afisare(char *s){
//Subprogram subpunct b
for(int i=0;i<strlen(s);i++){
if(s[i]==' ') cout << "_";
else cout << s[i];
}
}
int main(){
char s[70]="",cuv[70];
//Citire si modificare
ifstream f("atestat.txt");
while(!f.eof()){
f >> cuv;
//Modificare litera mare
if(cuv[strlen(cuv)-1]<='z' && cuv[strlen(cuv)-1]>='a') cuv[strlen(cuv)-1] = cuv[strlen(cuv)-1]+'A'-'a';
strcat(s,cuv);
strcat(s," ");
}
cout << s << endl;
afisare(s);
//Subpunct c
f.close();
bool ok=0;
ifstream f2("atestat.txt");
ofstream g("atestat.out");
while(!f2.eof()){
f2 >> cuv;
if(strlen(cuv)>=7){
ok=1;
g << cuv << " ";
}
}
if(!ok) g << "NU EXISTA ASTFEL DE CUVINTE";
}
Sper ca intelegi.