Jump to content
  • Advertisement
Sign in to follow this  
Titan2400

Cant program anything

This topic is 5037 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys im new to programming and my friend sent me a compiler called bloodshed-dev-c++ basically for c ++ i guess but when i try to put in words such as main void() it says its wrong and then change it to int(). The main i think is for c though then when i get the program to compile it opens it real fast then closes the window i even tried adding a enter (so the comp waits for me to press enter) like %s but it didnt work and still turned off and few erros also occured. here this is what i wrote for a simple program can you tell me if its right or wrong with a c ++ (this doesnt have a escape variable and jus closes) #include <stdio.h> int main() { printf("GoodBye, Cruel World!\n"); } ~thank you for reading~

Share this post


Link to post
Share on other sites
Advertisement
Your cod eis right the only problem is that it opens the console window only long enough to do all its porcesses.
To fix this add system("PAUSE"); after the printf statment.

Share this post


Link to post
Share on other sites
i remember when this happened to me

#include <stdio.h>
#include <windows.h>

int main()
{
print("...");
system("pause");
return 0;
}

edit: betten by 12 sec

Share this post


Link to post
Share on other sites
One other thing if you are programming in c++ and not c then you should do this:

#include <cstdio>

instead of this;

#include <stdio>

another thing is that the c++ version of printf (not that it matters what you use) is:
cout<<"text goes here";

Share this post


Link to post
Share on other sites
what does the include window.h thing do? and can i program c stuff into a c++ compiler or do i need a c compilier ? and whats the diffrence from the stdio thing? Becuase i got that upper program from the c for dummies book from teh begining and it didnt work and didnt ask for a pause series i was wondering why it is so diffrent :(

Share this post


Link to post
Share on other sites
so if c++ is a backward thing to c programs then that means c variables and c keys will work in the c++ compiliers cuz in my eyes it seems that it doesnt :/ and should i put the insert windows.h now for now on ? also what if i suppose i wanted to add a scanf sequence whhat should i do>>?

Share this post


Link to post
Share on other sites
i got another problem my friend jus gave me a c compilier and stuff but it says this error can you tell me what it means

C:\Documents and Settings\Administrator\Desktop\C
Projects\WHORU.c: line 7: Parse Error, expecting `SEP'
'char me[20] printf("What is your name?")'
aborting compile

from this source

#include <stdio.h>

void main()
{
char me[20;

printf("What is your name?");
scanf("%s",&me);
printf("Darn glad to meet you, %s!\n",me);
}

also when i answer the first question it closes the window once agaain. :(
and it doesnt show the dark glad to meet you part

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!