whats wrong with my code?

+1 danial saufi · November 26, 2014
#include <iostream>
#include <string>
#include <cmath>
using namespace std;

void bucket(){
  cout << "hello" << endl;
}
int bucketLogo( int x , int y , int z){

    int totalLogo = x + y + z;
   return totalLogo;
}
float bucketPerimeter( float L , float H){

    float totalPerimeter = L * H;
   return totalPerimeter;
}
int main()
{
   int a;
   int b;
   int c;
   float D;
   float Z;
   int totalLogo;
   double totalPerimeter;
   bucket();
   cin >>  a;
   cin >>  b;
   cin >>  c;
   bucketLogo(a,b, c);
   cout << "your total is " << totalLogo << endl;
   cout << "Enter the perimeter" << endl;
   cin >> D;
   cin >> Z;
   bucketPerimeter(  D , Z );
   cout << " the perimeter is " << totalPerimeter << endl;



}
when i enter the number, any number it goes out
your total is 1973031266
the perimeter is 5.79013e-120
p.s im a newbie still so don judge me
need some suggestion and explain why it is wrong

Post a Reply

Replies

Oldest  Newest  Rating
0 Bernard Pyc0d333 Parah · December 9, 2014
if you are gonna use it later, then include it when you need it
0 danial saufi · November 27, 2014
@ Mathias Frits Rørvik
wow thanks. man i still need more practice... umm y does it print out a wierd number..(at the top i said what number it was).. i tried changing the input number but it still comes out the same. and if i include string and cmath, does it affect the program or will the program become heavy? because i included it for future uses
0 danial saufi · November 27, 2014
@ Mathias Frits Rørvik
oh thanks man.. i still need to practice .. umm will the program be heavy or will it ruin the program if i include cmath and string cause i put there for future use.
  • 1

C++

124,551 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator