get fatal error

trying to print resistor but compiler shutsdown

Page 1 of 1

2 Replies - 359 Views - Last Post: 13 November 2008 - 09:04 AM Rate Topic: -----

#1 sublime7727  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 13-November 08

get fatal error

Posted 13 November 2008 - 08:09 AM

#include <iostream>
using namespace std;
void main (){
int req, r, sum, c;
if (c==0){
			req=r;
			cout<<r<<endl;
}
else if (c==1){
			req+=r;
			cout<<req<<endl;
}
else if (c==2){
			req= req*r/(req+r);
			cout<<req<<endl;
}
else if (c== -1){
	cout<<"equvialent resistance:"<<req<<endl;
}
}





This program doesnt seem to compute anything can you check and see what I have to fix to make this and operational program?

Is This A Good Question/Topic? 0
  • +

Replies To: get fatal error

#2 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3116
  • View blog
  • Posts: 19,154
  • Joined: 14-September 07

Re: get fatal error

Posted 13 November 2008 - 08:17 AM

You need to initialize 'c' to something. Either in its declaration or through user input.
Was This Post Helpful? 0
  • +
  • -

#3 xerxes333  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 31
  • View blog
  • Posts: 504
  • Joined: 05-July 07

Re: get fatal error

Posted 13 November 2008 - 09:04 AM

you also need to post your code between the [code ][/code ] tags ;)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1