Thread: Where do i put this?

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    18

    Where do i put this?

    STUPID QUESTION:

    I'm using Bloodshed Dev C++ and i want to know waht that main.cpp is for and where i put other codes/scripts i want to put in the project..
    I've never programmed in C or C++ so this is a n00by question.

  2. #2
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    File > New Project > Choose 'Empty Project'
    From the Project bar on the left, right click the project name, and select add to project.

    Also, calling yourself STUPID and a N00BY, doesn't make anyone more helpful.
    Sent from my iPadŽ

  3. #3
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    main.cpp is the default source file that Dev-C++ generates for you when you create a new project.

    You can create other source files and add them into the current project by going to Project | Add to Project.

  4. #4
    Registered User
    Join Date
    Jun 2006
    Posts
    18
    when i create an empty project and add a code to it, it opens in DOS mode. How do i make it open on a Windows window.

  5. #5
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    You are creating a console application. Creating windows based application is not an easy task past what Dev-C++ offers as the initial template.

    I suggest you learn C++ first by using only console applications.

    Regardless, to create a windows based application, File->New->Project and choose the "Windows" named icon. Most probably to the left of the other icons
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  6. #6
    Registered User
    Join Date
    Jun 2006
    Posts
    18
    k so i'll create something on DOS mode (Console applications) first...
    thanks for the helps

  7. #7
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    Creating DOS apps is a precursor to writing Windows (or Linux or Mac or Motorola phone, for that matter) programs. C++ is hard enough in DOS mode, so you should cover your basics well before moving on to advanced things.
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Might want to read say, this thread, before Bubba jumps on you.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do i put a graphics - console application
    By hero_bash in forum C++ Programming
    Replies: 10
    Last Post: 06-12-2006, 05:03 PM
  2. How to put it into an array
    By HAssan in forum C Programming
    Replies: 2
    Last Post: 10-10-2005, 01:19 PM
  3. Combining user inputs to put into System()
    By TDMedia in forum C++ Programming
    Replies: 6
    Last Post: 09-08-2005, 12:00 AM
  4. cant figure out where to put the loop....
    By seal in forum C Programming
    Replies: 2
    Last Post: 08-30-2005, 10:10 AM
  5. What /what not to put in header files
    By Just in forum C Programming
    Replies: 1
    Last Post: 12-14-2002, 10:45 AM