Jump to content
Sign in to follow this  
TemanX

C++

Recommended Posts

kepada sape2 yang nak blaja Dev C++, korg bleh add aku nye YM- [email protected]..

aku pun tk la pandai sangat tapi boleh kita bincang2.. aku ade manual c++ dan tutorial..

kalau aku bz, email je k..

visit blog aku - www.harizreborn.blogspot.com .......

Share this post


Link to post
Share on other sites

yg ni 100% working , 0% error

// Program to convert temperature from Celsius degree
// units into Fahrenheit degree units:
// Fahrenheit = Celsius * (212 - 32)/100 + 32
//
#include <cstdio>
#include <cstdlib>
#include <iostream>

using namespace std;

int main(int nNumberofArgs, char* pszArgs[])
{

// enter the temperature in Celsius
int celsius;
cout <<"Enter the temperature in Celsius:";
cin >>celsius;


// calculate conversion factor for Celsius
// to Fahrenheit
int factor;
factor = 212 - 32;
// use conversion factor to convert Celsius
// into Fahrenheit values
int fahrenheit;
fahrenheit = factor * celsius/100 + 32;

[code] 
// output the results (followed by a NewLine)
cout <<"Fahrenheit value is:";
cout <<fahrenheit<<endl;
// wait until user is ready before terminating program
// to allow the user to see the program results
//system("PAUSE");
return 0;
}

tp yg part system("PAUSE") tu aku terpaksa disablekan sbb kalo x disablekan masa run tetiba pc aku auto shutdown.korang mcm mn?x kena mcm aku kena ker?

Share this post


Link to post
Share on other sites

tp yg part system("PAUSE") tu aku terpaksa disablekan sbb kalo x disablekan masa run tetiba pc aku auto shutdown.korang mcm mn?x kena mcm aku kena ker?
hmm pelik gak tu...aku xde C++ compiler skang nk test, so xtau la :D...

tp satu je nk bg pendapat...

kalu buku/tutorial yg guna system("PAUSE") hanya utk pausekan program supaya user smpt tengok result, elok jgn baca dah buku tu :D...

sbb, panggil system command hanya kerana tu, menyebabkan program tu akan call shell API...dimana x perlu membebankan cpu dan memory kita hanya utk tu :D...

mmg x nampak sgt utk pc jaman sekarang, tapi sbg programmer, apa yg berlaku bila kita guna command tu menyebabkan kita xnak guna dah command tu huhu...

satu lagi, "PAUSE" hanya compatible ngan Windows, so bkn cross-platform..

so elok guna cthnya:

cin.ignore();

cin.get();

sbg ganti system("PAUSE")...computer happy, user happy, kita pon happy :D..

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...