+ 1
What is outpot
#include<iostream> #include<fstream> using namesspace std; int main() { int a[] = { 15, 4, 3, 5, 15 }; int b[5] = { 4, 3,-2, -1,-3 }; int c[5]; ofstream fcout; fcout.open("witeto.txt"); for (int j = 0; j< 5; j++) { c[j] = a[j] + 2*b[j]; } fcout << c[1] << " "; cout << std::endl; fcout.close(); return 0; }
2 Antworten
+ 1
Watch the spelling of output.
+ 1
can you not run the program in your fave ide and check it out?
not sure writting to a file will work here.
But, since output is written to file, output should be in writeto.txt and will be the value of c[1].
Not sure what is with the cout << looks like a typo.
should that not be fcout?
if not then you have two outputs. one, the value of c[1] + space in your file, and two the newline charcacter in standard output stream.