Very weard error

closed account (4i67ko23)
This is a very simple program, I only have a stupid error and I don't see what's wrong...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <windows.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <fstream>

int main()
{
    int n = rand() % 26;
    char c = (char)(n+65);
    cout << c << endl;
    Sleep(10000);
    return 0;
}




11 C:\Users\Mathijs\Documents\C++\test13.cpp `cout' undeclared (first use this function)

11 C:\Users\Mathijs\Documents\C++\test13.cpp `endl' undeclared (first use this function)
Last edited on
you need to either put using namespace std; between #include <fstream> and main, or do std::cout, std::endl; cout and endl are part of the std namespace, without it you cant use either of those without errors.
Last edited on
closed account (4i67ko23)
Crap, I always forget those small things....
Lol i hear ya, i do the same stuff sometimes too.
Topic archived. No new replies allowed.