g4145's Profile User Rating: -----

Reputation: 2 Apprentice
Group:
New Members
Active Posts:
8 (0.02 per day)
Joined:
19-May 12
Profile Views:
106
Last Active:
User is offline Jun 09 2012 02:15 AM
Currently:
Offline

Previous Fields

Country:
PT
OS Preference:
Linux
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
Playstation
Your Car:
Who Cares
Dream Kudos:
0

Latest Visitors

  • Photosepp2k Icon
    19 May 2012 - 13:56
Icon   g4145 has not set their status

Posts I've Made

  1. In Topic: converting char to int

    Posted 25 May 2012

    This is not an ellegant solution, although it works for me.. Just try to get some ideas from this code :)


    MOD EDIT: Please stop giving out the complete solution to problems. We are here to help people to learn to program. Not provide the complete code for them.

    Code removed.

    Jim
  2. In Topic: trouble opening a file

    Posted 21 May 2012

    Hum, I don't know what you really want, but I guess it's something like this:

    #include <stdio.h>
    
    int main(int argv, char *argc[])
    {
    	FILE *fin;
    	char x[20];
    	fgets(x, 20, stdin);
    	fin = fopen(x, "w");
    	
    	if(fin != NULL)
    		printf("File opened...\n");
    	else
    		printf("File not opened...");
    	
    	return 0;
    }
    
    
  3. In Topic: Hours and minutes in time error (basic)

    Posted 19 May 2012

    Or maybe this, I think this is what you really want:

    #include <iostream>
    using std::cout;
    using std::cin;
    using std::endl;
    
    
    void timeRet(int, int);
    int hours;
    int minutes;
    
    
    int main()
    {
    	cout << "Enter the number of hours:" << endl;
        cin >> hours;
        cout << "Enter the number of minutes:" << endl;
        cin >> minutes;
        timeRet(hours, minutes);
        return 0;
    }
    
    void timeRet(int time1, int time2)
    {
    	cout << time1 << ":" << time2 << endl;
    }
    
    
    
  4. In Topic: Hours and minutes in time error (basic)

    Posted 19 May 2012

    Well, using a void function I would do something similar to this:

    #include <iostream>
    using std::cout;
    using std::cin;
    using std::endl;
    
    
    void timeRet();
    int hours;
    int minutes;
    
    
    int main()
    {
    	cout << "Enter the number of hours:" << endl;
        cin >> hours;
        cout << "Enter the number of minutes:" << endl;
        cin >> minutes;
        timeRet();
        return 0;
    }
    
    void timeRet()
    {
    	cout << hours << ":" << minutes << endl;
    }
    
    
  5. In Topic: I don't understand how to - User-Defined functions

    Posted 19 May 2012

    User defined functions are functions that allow the programmer to define there own functions, I mean, functions that are not included in the standard C++ libraries. For example, you could easily write a function to solve the Fibonnaci sequence because as far as I know there isn't any C++ library that includes that.
    And remember, always start by the return type, followed by the function name, arguments and then the body of your function :)

My Information

Member Title:
New D.I.C Head
Age:
18 years old
Birthday:
May 26, 1994
Gender:
Location:
Portugal
Programming Languages:
C

Contact Information

E-mail:
Click here to e-mail me
MSN:
MSN  andrepdpinheiro@hotmail.com

Comments

g4145 has no profile comments yet. Why not say hello?