Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

C++ programming

Status
Not open for further replies.

tuck

New Member
Hi all,
sorry to disturb u guys again.
i having a problem with my study.
i have no no idea how to solve the question.
can any1 help me to solve it?
thank you very much.
 

Attachments

  • 01.JPG
    01.JPG
    65.6 KB · Views: 272
The reading in the page of this is hard for me to comprehend. but I'm guessing you're working with arrays.... obliviously.
Just out of curiosity what compiler are you using? and the OS.

Arrays

That helped me a lot when I was learning arrays.
Small chuckle to myself....I'm 14 and I'm guessing this guy is in collage..... and yet I'm failing in school.
 
Hey tuck I've got a question for you. I'm stuck on this code right now. I'm trying not to look in any of my books or anything. but I compiled this code with no errors and it closes when you enter a number

Code:
#include <iostream>
using namespace std;
int main ()
{
  int i;
  cout << "Please enter the degrees in Celcius ";
  cin >> i;
  cout << "That number in fahrenheit is: " << i*1.8 + 32 << ".\n";
  return 0;
}

and for some reason it's not coming out right. its going to keep me up all night that a super simple code is not working.
 
David,

That code works fine. See attached.

Mike.
 

Attachments

  • cmd.png
    cmd.png
    12.6 KB · Views: 258
hey. not to hijack the thread but heres my code.

Code:
#include <iostream>
using namespace std;
int main ()
{
  double i;
  cout << "Please enter the degrees in Celcius ";
  cin >> i;
  cout << "That number in fahrenheit is: " << (i*1.8)+32 << ".\n";
  return 0;
}
 
Hi david,

I'm using CodeBlocks with the Ming G++ compiler. Are you sure it isn't just the window shutting down. Try changing your code to,
Code:
#include <iostream>
using namespace std;
int main ()
{
  int i;
  while(1){
      cout << "Please enter the degrees in Celcius ";
      cin >> i;
      cout << "That number in fahrenheit is: " << i*1.8 + 32 << ".\n";
  }
  return 0;
}
When you want to quit out of the above press Ctrl-C.

Mike.
 
Oyyyyy, not all compilers are same, some follow standards, some bend them:

Try this:

Code:
#include <iostream>

using namespace std;

int main (){

  double i;

  cout << "Please enter the degrees in Celcius: ";
  cin >> i;
  cout << "That number in fahrenheit is: " << (i*1.8)+32 << ".\n";


  system("pause");
  return 0;
}
 
This is really really pissing me off. Every program i write and compile it closes when you enter a number in the console and hit "enter". I googled this and nothing relative to this topic is around.
 
I've attached the zipped exe file, what happens if you run this?

Did you download the version of Dev-C++ that included the mingw compiler?

Mike.
 

Attachments

  • temperature.zip
    157.3 KB · Views: 207
I've attached the zipped exe file, what happens if you run this?

Did you download the version of Dev-C++ that included the mingw compiler?

Mike.

Yeah that one works. althought i would put the system pause before the cin and cout's. i will uninstall and reinstall devC++
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top