I started c++ yesterday and can't for the life of me figure out what I am doing wrong. I am trying to make a small code that takes user input for three numbers and then calculates the squareroot of each number.
#include "stdafx.h"
#include <iostream>
#include <cmath>
using std::cout;
using std::cin;
int squareroot(){ //function to find squareroot.
int sQ1 = sqrt(number1); //variable for the square of number1
int sQ2 = sqrt(number2); //variable for the square of number2
int sQ3 = sqrt(number3); //variable for the square of number3
cout << sQ1 << "\n";//outputs the square of number 1
cout << sQ2 << "\n";//outputs the square of number 2
cout << sQ3 << "\n";//outputs the square of number 3
}
int main() { // main function
int number1 = 0; //first number
int number2 = 0; //second number
int number3 = 0; //third number
cout << "type number1"; //asks user to input first number
cin >> number1; //stores user input into variable number1
cout << "type number2"; //asks for second number
cin >> number2; //stores second number into number2
cout << "type number3"; // asks for third number
cin >> number3; //stores third number
cout << number1 << "\n"; //outputs number1
cout << number2 << "\n"; //ouputs number2
cout << number3 << "\n"; //outputs number3
squareroot(); //runs function squareroot()
}