+ 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; }

23rd Dec 2020, 7:09 PM
D•A•M GH
2 Antworten
+ 1
Watch the spelling of output.
23rd Dec 2020, 10:36 PM
Sonic
Sonic - avatar
+ 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.
23rd Dec 2020, 7:39 PM
Javadev