stuck on this.

This is a discussion on stuck on this. within the C++ Programming forums, part of the General Programming Boards category; Originally Posted by typeqwerty but when i run it on a site it where it automatically compile it would say ...

  1. #16
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,657
    Quote Originally Posted by typeqwerty View Post
    but when i run it on a site it where it automatically compile it would say i failed.
    Oh. Those sites are horrible.

  2. #17
    Registered User
    Join Date
    Sep 2012
    Posts
    8
    do you know how to get the output as when i input 1000


    Enter a number of seconds:
    There are 16.667 minutes in 1000.000 seconds.

    my output would say
    Enter a number of seconds:
    There are 16.666667 minutes in 1000.000000 seconds.
    There are 0.277778 hours in 1000.000000 seconds.
    There are 0.011574 days in 1000.000000 seconds.

    what code would make it have 2 lines instead of 3?

  3. #18
    Registered User Eddie Ramos's Avatar
    Join Date
    Jan 2012
    Location
    CA
    Posts
    6
    Quote Originally Posted by typeqwerty View Post
    i need it to look like this. for example when i input 10000 it should say this as output. E


    Enter a number of seconds:
    There are 166.667 minutes in 10000.000 seconds.
    There are 2.778 hours in 10000.000 seconds.
    Code:
    #include <iostream>
    using namespace std;
    
    
    int main() {
    	double input,days,hours,minutes,seconds;
    	
    	cout << "Enter a number of seconds: ";
    	cin >> input;
    
    
    	seconds = input;
        minutes = seconds / 60;
        hours = minutes / 60;
    	days = hours / 24;
    	
    	cout <<endl << "There are " << minutes << " minutes in " << seconds << " seconds" <<endl;
    	cout << "There are " << hours << " hours in " << seconds << " seconds" <<endl;
    	cout << "There are " << days << " days in " << seconds << " seconds" <<endl;
    
    
    	return 0;
    }
    Last edited by Eddie Ramos; 09-29-2012 at 05:55 AM.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Just stuck indeed
    By TAboy24 in forum C++ Programming
    Replies: 3
    Last Post: 11-19-2007, 03:32 PM
  2. Stuck - Need a little help
    By nevek in forum C Programming
    Replies: 9
    Last Post: 06-11-2007, 03:57 PM
  3. A little stuck.. is this possible?
    By Ganoosh in forum C++ Programming
    Replies: 6
    Last Post: 07-20-2005, 03:06 PM
  4. Stuck with '\b'
    By pratip in forum C++ Programming
    Replies: 5
    Last Post: 10-28-2003, 06:49 AM
  5. Stuck again!
    By shewolf in forum C++ Programming
    Replies: 17
    Last Post: 10-23-2003, 12:27 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21