I am receiving errors like cout is undeclared identifier
I have gone through MULTIPLE times and there is nothing I can see that I have done wrong! I am knew so please be patient.
I have checked everything multiple times and this just does not make since to me.
Main.cpp
#include <iostream>
#include <limits>
#include "add.h"
int main()
{
std::cout << "this will call function which will have you type in numbers which when done will call the second function as well as giving the second function answers to what it needs. " << '\n';
int numOne{ function() };
int numTwo{ function() };
std::cout << "With those two numbers we can add them! and our answer is!" << functionTwo(numOne, numTwo) << '\n';
std::cout << "we now sent functionTwo the numbers we made using function for simplness. Now functionTwo can have the numbers it needs to do what it needs to do." << '\n';
// This code will make it not close automatically.
std::cin.clear();
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
std::cin.get();
return 0;
}
add.cpp
#include <iostream>
#include "add.h"
int functionTwo(int a, int b)
{
std::cout << " fdsaf dasf dsa" << '\n';
std::cout << 2 * a << '\n';
std::cout << 2 + b << '\n';
int c{ 2 + b };
int d{ 2 * a };
return c + d;
}
add2.cpp
#include <iostream>
#include "add.h"
int function()
{
int a{ 0 };
std::cin >> a;
return a;
}
add.h
#ifndef _IOSTREAM_
#define _IOSTREAM_
int function();
int functionTwo(int a, int b);
#endif
I am using Microsoft Visual studio and I am trying to compile this. I made sure to make new items / the .cpp files and the .h file. I have tried deleteing the pch.h and the pch.cpp files but I just don't understand what I am doing wrong. Please help me. I am knew so I am sorry for that.