3
#include <iostream>
using namespace std;
int main()
{
int nombre, carre ;
cout << "Introduza un numero : " ;
cin >> nombre ;
carre = nombre * nombre ;
cout << "A raiz quadrada est ; " << carre ;
}
When I compile with GCC:
gcc -Wall -Wextra -Werror -o calc_carre calc_carre.cpp
Obtenho:
calc_carre.cpp:(.text+0xe): Undefined Reference to
std::cout' calc_carre.cpp:(.text+0x13): undefined reference to
Std::basic_ostream >&Std::Operator<< >(Std::basic_ostream >&, char const*)' calc_carre.cpp:(.text+0x1f): Undefined Reference tostd::cin' calc_carre.cpp:(.text+0x24): undefined reference to
Std::istream::Operator>>(int&)' calc_carre.cpp:(.text+0x3a): Undefined Reference tostd::cout' calc_carre.cpp:(.text+0x3f): undefined reference to
Std::basic_ostream >&Std::Operator<< >(Std::basic_ostream >&, char const*)' calc_carre.cpp:(.text+0x4f): Undefined Reference tostd::ostream::operator<<(int)' /tmp/cclJ9vPR.o: In function
__static_initialization_and_destruction_0(int, int)': calc_carre.cpp:(.text+0x7d): Undefined Reference tostd::ios_base::Init::Init()' calc_carre.cpp:(.text+0x8c): undefined reference to
Std::ios_base::Init::~Init()' collect2: error: Ld returned 1 Exit status
In the C:
#include <stdio.h>
int main()
{
int nombre, carre ;
printf ("Introduza un numero") ;
scanf ("%d", &nombre) ;
carre = nombre * nombre ;
printf (" A sua raiz quadrada é: %d, nombre) ;
}
When I compile I get no mistake, but look through your eyes:
Use #include <iostream> or #include<stdio. h>
– Felipe
Just do not include it in stackoverflow because the site does not leave but it is present
– Micael André
printf ("o seu quadrado é: ...", carre)
– JJoao
OK; Merci, just one more question How can I take the % that appears at the end I will send a photo for you to see, here is the link: https://goo.gl/photos/b1imFWZyo6k2mDmu7
– Micael André