if i download the programs for c++ on my pc ( codebuilds and the compiler ) and i want to write a program in my package ( workspace ) i create a new file and write smthing beginning #include <iostream> using namespace std; int main () { ... } and i want to run it, it always runs this first program : Hello World. and not my written program how can i run just my written program ? have i maybe to write anything else as int main () {} ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

if i download the programs for c++ on my pc ( codebuilds and the compiler ) and i want to write a program in my package ( workspace ) i create a new file and write smthing beginning #include <iostream> using namespace std; int main () { ... } and i want to run it, it always runs this first program : Hello World. and not my written program how can i run just my written program ? have i maybe to write anything else as int main () {} ?

19th Jul 2016, 2:11 PM
Peter Müller
Peter Müller - avatar
16 Answers
+ 2
yes in main u have to write clrscr(); which means clear screen and it will show your new programme
19th Jul 2016, 2:29 PM
Rei Ōgami
Rei Ōgami - avatar
+ 1
ty
19th Jul 2016, 2:38 PM
Peter Müller
Peter Müller - avatar
+ 1
have i to return everything with return 0; ?
19th Jul 2016, 2:43 PM
Peter Müller
Peter Müller - avatar
0
where have i to write it ?
19th Jul 2016, 2:34 PM
Peter Müller
Peter Müller - avatar
0
can main stay as it is then ?
19th Jul 2016, 2:34 PM
Peter Müller
Peter Müller - avatar
0
int main{ clrscr(); then continue your code
19th Jul 2016, 2:35 PM
Rei Ōgami
Rei Ōgami - avatar
0
I hope you got the point
19th Jul 2016, 2:35 PM
Rei Ōgami
Rei Ōgami - avatar
0
int main() { clrscr(); ..... }
19th Jul 2016, 2:37 PM
Rei Ōgami
Rei Ōgami - avatar
0
please try now this one
19th Jul 2016, 2:37 PM
Rei Ōgami
Rei Ōgami - avatar
0
i'm outside now will try it later
19th Jul 2016, 2:38 PM
Peter Müller
Peter Müller - avatar
0
welcome bro
19th Jul 2016, 2:38 PM
Rei Ōgami
Rei Ōgami - avatar
0
but why did u change the main from int main to int main() ?
19th Jul 2016, 2:39 PM
Peter Müller
Peter Müller - avatar
0
it don't work
19th Jul 2016, 6:04 PM
Peter Müller
Peter Müller - avatar
0
maybe i told my question false : i have 2 tabs open in codeblocks and both of it are main programs but it always runs the first of the programs
19th Jul 2016, 6:07 PM
Peter Müller
Peter Müller - avatar
0
Maybe the hello world project was active, but the file you're seeing is not in it. you can double click a project to make it active. and the program that it will build is always the active one. so double click your project.
20th Jul 2016, 12:22 PM
_Geometry dash_ _Roh_ (AKA NovaRate0315)
_Geometry dash_ _Roh_ (AKA NovaRate0315) - avatar
0
doubleclick my project or my new file ( program ) ? because the hello world prgram is in my project
20th Jul 2016, 1:18 PM
Peter Müller
Peter Müller - avatar