Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,562 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,906 people online right now. Registration is fast and FREE... Join Now!




Compiler Help

 
Reply to this topicStart new topic

Compiler Help

sno
7 May, 2008 - 05:16 PM
Post #1

New D.I.C Head
*

Joined: 4 May, 2008
Posts: 17


My Contributions
Hey

any ideas why when i try to include iostream and string header files my compiler doesnt include them? heres my code that is not working....

CODE

#include <iostream>
#include <string>

int main(){

    string Days[6];
        Days[0] = "Sunday";
        Days[1] = "Monday";
        Days[2] = "Tuesday";
        Days[3] = "Wednesday";
        Days[4] = "Thursday";
        Days[5] = "Friday";
        Days[6] = "Saturday";

    int Day,;
    long JulianDay;

    while(1){
        cout << "Julian Day: ";
        cin >> JulianDay;

        if (JulianDay == 0){
            break;
        }

        Day = JulianDay % 7;

        cout << "Julian Day " << JulianDay << " is a " << Days[Day] << endl;
    }
    return 0;
}


and i get errors like 'string was not declared' 'endl was not declared' 'cout was not declared'... im using code::blocks with the minigw compiler and windows xp.

User is offlineProfile CardPM
+Quote Post

KYA
RE: Compiler Help
7 May, 2008 - 05:17 PM
Post #2

#include <nerd.h>
Group Icon

Joined: 14 Sep, 2007
Posts: 4,924



Thanked: 105 times
Dream Kudos: 1200
My Contributions
Need to add this after the includes:

cpp

using namespace std;

User is offlineProfile CardPM
+Quote Post

sno
RE: Compiler Help
7 May, 2008 - 05:21 PM
Post #3

New D.I.C Head
*

Joined: 4 May, 2008
Posts: 17


My Contributions
ohhh ok..

thanks

edit :: After i added that it compiled but then 'experience and error' ...

edit again :: nevermind.. array wasnt big enough >.>

This post has been edited by sno: 7 May, 2008 - 05:24 PM
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/2/08 11:40PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month