This is the code. When I run it, nothing appears, just darkness. Blank. I'm a beginner, and I don't really know too much about coding. Any help would be appreciated.
#include <iostream>
using namespace std;
int main()
float x;
float y;
float Wynik;
x = 1.4;
y = 5.8;
Wynik = (x * y + x + y) / (x-y);
return 0;
}
Because you aren't printing out anything in your console. To print your results, use std::cout << Wynik;
. And also, you have an error in your main function, it's supposed to be like this:
int main() {
// Your code goes here
}
Also, using namespace std;
is considered bad practice since it can lead to conflicts with your other libraries, but you'll read that in a book.
#include <iostream>
using namespace std;
int main() {
float x;
float y;
float Wynik;
x = 1.4;
y = 5.8;
Wynik = (x * y + x + y) / (x-y);
cout << Wynik << endl; // This will print your output
return 0;
}
#include <iostream>
int main()
{
const float x = 1.4;
const float y = 5.8;
std::cout << (x * y + x + y) / (x - y) << std::endl; // This will print your output
return 0;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.