Why does my compiled code not run in C++? [closed] - c++

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I made a simple c++ program:
#include <iostream>
int main(){
for (int i = 0; i >=; i++){
std::cout << i << "\n";
}
return 0;
}
It compiles but the output .exe doesn't run.
Edit: I used GNAT Studio 2021 compiler.

The termination condition is incorrect : i >=.
You can choose a number of turn of the loop, for exemple 10 with : i<=10.

Related

What am I doing wrong, it's very basic C++ but gives an error? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
the code i wrote
What am i doing wrong in here it gives me an error and its very very basic.
enter code here
# include <iostream>
using namespace std;
int main()
{
string firstone = "giraffe academy";
cout << firstone.substr(8, 3);
return 0;
}
You need to
# include <string>
that defines << for std::string

Godbolt does not show stdout [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I am using https://godbolt.org/ to compile a simple C++ script but even the simplest
int main()
{
std::cout << "Hello World!" << std::endl;
}
When I click Add new... --> Compiler --> Output I get: Compiler returned: 0
As #Ayxan Haqverdili told me the missing steps are Output... > Run the compiled output

Why is there a difference in output between printf and cout? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
The code using printf and cout:
int a=0;
a=printf("Hello World");
cout<<" "<<a;
Output :
11Hello World
The code using printf:
int a=0;
a=printf("Hello World");
printf("%d ",a);
Output :
Hello World11
You must have disabled synchronization between std::cout and C API?
If it is enabled I can't reproduced it
If I disable this synchronization I reproduce observed output.
For more information read about std::ios::sync_with_stdio

std does not contain, but it should as have added the library [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
Hi guys I am just starting to use C++ and I have a problem when I run this short code
#include <cmath>
#include <iostream>
int main()
{
std::cout << std::legendre(3, 0.25);
}
I get that std does not contain legendre, but I am fairly sure it is in cmath. Can someone give advice?
std::legendre was introduced in C++ since C++17. gcc compiles your code with no problem since version 7, clang since version 5 and MSVC since preview 2018 https://godbolt.org/z/reoiaD
You need to enable C++17 with -std=c++17 and possibly update your compiler.

a Sequential that decreased by 5 using a for loop [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
i want to print a Sequential that decreased by 5
using a for loop
but i don't know why it doesn't print the output :(
#include<bits/stdc++.h>
using namespace std;
int main(){
for(int j=60;j<=0;j-=5){
cout<<j<<endl;
}
}
whats the wrong?!
Change it to
for(int j=60;j>=0;j-=5){
^^