Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
#33
#include <iostream> #include <string> #include <fstream> using namespace std; bool wczytajPlik() { ifstream plik; plik.open("input.txt"); if (!plik.good()) return false; int suma; while (true) { int a; plik >> a; cout << "[" << a << "] " << a << endl; suma += a; if (!plik.good()) break; } cout << "Suma: " << suma << endl; return true; } int main() { if(!wczytajPlik()) cout << "Blad otwierania pliku!" << endl; return 0; } // do tego potrzebny jest plik input.txt z liczbami oddzielonymi spacja
run
|
edit
|
history
|
help
0
Not an overflow
rvalue lifetime
Affine Key Finder and Decrypter
VC++ windows exception
define own struct
students grade
C++ exception
hangman
Program_2
cv3