Hello World,
I'm a c++ beginner and i've diced to study. So this is my first code:

#include <iostream>
using namespace std;

double d = 2.2;
int i = 7;

void some_function()
{
	d = d + i;
	i = d * i;
	printf("%d\n", d);
	printf("%d\n", i);

}


int main(){
	return 0;
}

when i try to compile this, i get this answer:
a.cpp: In function ‘void some_function()’:
a.cpp:11: error: ‘printf’ was not declared in this scope

It's a elementary mistake but i can't see. If you can help me...

Recommended Answers

All 2 Replies

#include <cstdio> which is the C++ version of the stdio.h header.

#include <cstdio> which is the C++ version of the stdio.h header.

Thanks jonsca

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.