Post: My first program + I need a bit of help about something. (C++)
11-28-2011, 07:55 PM #1
MacPale
Indeed.
(adsbygoogle = window.adsbygoogle || []).push({}); Hellllooooo so today i just made my first functional program well obviously I've done the "Hello World" ones but this is my first one that is somewhat useful and i created myself. So anyway here it is it works perfectly its just an application to calculate the Area and Perimeter of a right angled triangle using the lengths of the base height and hypotenuse. Its pretty simple just please remember im a complete noob only been learning c++ a day or 2 and this was off the top of my head.

#include <iostream>

using namespace std;
int main()
{

int base;
int hyp;
int height;
int perimeter;
int area;

cout<< "Enter the length of the base :" ;
cin>>base;
cout<< "Enter the length of the hypotenuse or slanted side :";
cin>>hyp;
cout<< "Enter the heighth of the triangle :" ;
cin>>height;

perimeter=base+hyp+height;
area=0.5*base*height;

cout<< endl;
cout<< "The perimeter is :" <<perimeter<<endl;
cout<< "The area is :" <<area<<endl;
cout<< endl;

system("PAUSE");
return 0;

}

ANYWAY where i need help is, althought the program runs perfectly im getting some errors while compiling and im hoping some of you programming genies can help me with this . Here are the errors im getting :

'Right angled triangle.exe': Loaded 'C:\Users\CPP\Documents\Visual Studio 2010\Projects\Right angled triangle\Debug\Right angled triangle.exe', Symbols loaded.
'Right angled triangle.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'Right angled triangle.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'Right angled triangle.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'Right angled triangle.exe': Loaded 'C:\Windows\System32\msvcp100d.dll', Symbols loaded.
'Right angled triangle.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
The thread 'Win32 Thread' (0xb80) has exited with code -1073741510 (0xc000013a).
The program '[2868] Right angled triangle.exe: Native' has exited with code -1073741510 (0xc000013a).

Cheers for looking guys hope you can help and remember im a noob and just used formulas from my head for this nothing special just trying to work on my programming heh Smile
Last edited by MacPale ; 11-28-2011 at 07:57 PM. Reason: left out something
11-28-2011, 08:01 PM #2
fill0botto95
You talkin to me?
Premission: I started C++ 2 months ago at school

maybe you should save you project before compiling it
11-28-2011, 08:25 PM #3
MacPale
Indeed.
Originally posted by fill0botto95 View Post
Premission: I started C++ 2 months ago at school

maybe you should save you project before compiling it


I wish our school did C++. Anyway thanks for the imput.
11-28-2011, 08:41 PM #4
fill0botto95
You talkin to me?
Originally posted by MacPale View Post
I wish our school did C++. Anyway thanks for the imput.


pfff...we are doing very basic things, i prefer my intermedium vb.net Winky Winky
11-28-2011, 08:48 PM #5
Epic?
Awe-Inspiring
Originally posted by MacPale View Post
Hellllooooo so today i just made my first functional program well obviously I've done the "Hello World" ones but this is my first one that is somewhat useful and i created myself. So anyway here it is it works perfectly its just an application to calculate the Area and Perimeter of a right angled triangle using the lengths of the base height and hypotenuse. Its pretty simple just please remember im a complete noob only been learning c++ a day or 2 and this was off the top of my head.

#include <iostream>

using namespace std;
int main()
{

int base;
int hyp;
int height;
int perimeter;
int area;

cout<< "Enter the length of the base :" ;
cin>>base;
cout<< "Enter the length of the hypotenuse or slanted side :";
cin>>hyp;
cout<< "Enter the heighth of the triangle :" ;
cin>>height;

perimeter=base+hyp+height;
area=0.5*base*height;

cout<< endl;
cout<< "The perimeter is :" <<perimeter<<endl;
cout<< "The area is :" <<area<<endl;
cout<< endl;

system("PAUSE");
return 0;

}

ANYWAY where i need help is, althought the program runs perfectly im getting some errors while compiling and im hoping some of you programming genies can help me with this . Here are the errors im getting :

'Right angled triangle.exe': Loaded 'C:\Users\CPP\Documents\Visual Studio 2010\Projects\Right angled triangle\Debug\Right angled triangle.exe', Symbols loaded.
'Right angled triangle.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'Right angled triangle.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'Right angled triangle.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'Right angled triangle.exe': Loaded 'C:\Windows\System32\msvcp100d.dll', Symbols loaded.
'Right angled triangle.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
The thread 'Win32 Thread' (0xb80) has exited with code -1073741510 (0xc000013a).
The program '[2868] Right angled triangle.exe: Native' has exited with code -1073741510 (0xc000013a).

Cheers for looking guys hope you can help and remember im a noob and just used formulas from my head for this nothing special just trying to work on my programming heh Smile


Okay, so I'm not sure if fill0botto95 solved your problem or not, so I'll take a crack at it too...

First of all, when you post your code here on NGU (and other forums), be sure to put it into CODE tags, and you might also want to put your errors in CODE tags.

Now, first off, the code you posted compiles fine for me.

It looks like you're using the VC++ compiler (the one that comes by default with Visual Studio). If this is true, first off, remember that in Visual Studio C++ projects you need to add #include "stdafx.h", because in precompiled headers mode VC++ ignores everything prior to that line.

However, it's most likely that your problem results from not running as an administrator. First, close all currently opened instances of Visual Studio, then, when launching Visual Studio, right-click it, and select "Run as Administrator". It's also possible that you are either missing, or VC++ is not recognizing, those certain DLLs. If running as admin does not fix it, let me know.

Also, I would HIGHLY encourage you to switch to the You must login or register to view this content. for your compiler, if you're on Windows, I'd recommend You must login or register to view this content. (Minimalist GNU for Windows). It's probably more popular and easier to use, it's cross-platform, and allows you to get some experience working from the command line - and it's free and open source!
Last edited by Epic? ; 11-28-2011 at 08:52 PM.

The following user thanked Epic? for this useful post:

fill0botto95
11-28-2011, 11:34 PM #6
MacPale
Indeed.
Originally posted by Epic
Okay, so I'm not sure if fill0botto95 solved your problem or not, so I'll take a crack at it too...

First of all, when you post your code here on NGU (and other forums), be sure to put it into CODE tags, and you might also want to put your errors in CODE tags.

Now, first off, the code you posted compiles fine for me.

It looks like you're using the VC++ compiler (the one that comes by default with Visual Studio). If this is true, first off, remember that in Visual Studio C++ projects you need to add #include "stdafx.h", because in precompiled headers mode VC++ ignores everything prior to that line.

However, it's most likely that your problem results from not running as an administrator. First, close all currently opened instances of Visual Studio, then, when launching Visual Studio, right-click it, and select "Run as Administrator". It's also possible that you are either missing, or VC++ is not recognizing, those certain DLLs. If running as admin does not fix it, let me know.

Also, I would HIGHLY encourage you to switch to the You must login or register to view this content. for your compiler, if you're on Windows, I'd recommend You must login or register to view this content. (Minimalist GNU for Windows). It's probably more popular and easier to use, it's cross-platform, and allows you to get some experience working from the command line - and it's free and open source!


Thanks man that helps a lot, I have Code Blocks and i love using it its a lot easier to use than Visual Studio just for writing basic stuff like im doing here and i also already have MinGW but when i tried to link it with Code Blocks it gave a compiler error about the toolchain option in settings, i went and checked toolchain and everything is set up perfectly so i really dont know maybe you can help.
11-29-2011, 01:03 AM #7
Epic?
Awe-Inspiring
Originally posted by MacPale View Post
Thanks man that helps a lot, I have Code Blocks and i love using it its a lot easier to use than Visual Studio just for writing basic stuff like im doing here and i also already have MinGW but when i tried to link it with Code Blocks it gave a compiler error about the toolchain option in settings, i went and checked toolchain and everything is set up perfectly so i really dont know maybe you can help.


Try running as administrator, then when compiling your code, click Start Without Debugging... and are you seeing any errors?
11-29-2011, 02:24 AM #8
Originally posted by MacPale View Post
Hellllooooo so today i just made my first functional program well obviously I've done the "Hello World" ones but this is my first one that is somewhat useful and i created myself. So anyway here it is it works perfectly its just an application to calculate the Area and Perimeter of a right angled triangle using the lengths of the base height and hypotenuse. Its pretty simple just please remember im a complete noob only been learning c++ a day or 2 and this was off the top of my head.

#include <iostream>

using namespace std;
int main()
{

int base;
int hyp;
int height;
int perimeter;
int area;

cout<< "Enter the length of the base :" ;
cin>>base;
cout<< "Enter the length of the hypotenuse or slanted side :";
cin>>hyp;
cout<< "Enter the heighth of the triangle :" ;
cin>>height;

perimeter=base+hyp+height;
area=0.5*base*height;

cout<< endl;
cout<< "The perimeter is :" <<perimeter<<endl;
cout<< "The area is :" <<area<<endl;
cout<< endl;

system("PAUSE");
return 0;

}

ANYWAY where i need help is, althought the program runs perfectly im getting some errors while compiling and im hoping some of you programming genies can help me with this . Here are the errors im getting :

'Right angled triangle.exe': Loaded 'C:\Users\CPP\Documents\Visual Studio 2010\Projects\Right angled triangle\Debug\Right angled triangle.exe', Symbols loaded.
'Right angled triangle.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'Right angled triangle.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'Right angled triangle.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'Right angled triangle.exe': Loaded 'C:\Windows\System32\msvcp100d.dll', Symbols loaded.
'Right angled triangle.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
The thread 'Win32 Thread' (0xb80) has exited with code -1073741510 (0xc000013a).
The program '[2868] Right angled triangle.exe: Native' has exited with code -1073741510 (0xc000013a).

Cheers for looking guys hope you can help and remember im a noob and just used formulas from my head for this nothing special just trying to work on my programming heh Smile


also you could make it more advanced by using classes and what not. just saying.
next you should show the area radius size whatever of a bunch of other shapes.
this is great practice.
11-29-2011, 06:39 PM #9
MacPale
Indeed.
Originally posted by Epic
Try running as administrator, then when compiling your code, click Start Without Debugging... and are you seeing any errors?


Hold on I downloaded the program again and its working okay now Smile

Originally posted by Docko412 View Post
also you could make it more advanced by using classes and what not. just saying.
next you should show the area radius size whatever of a bunch of other shapes.
this is great practice.


yep but i dont know about classes and all that..
11-30-2011, 06:27 AM #10
Epic?
Awe-Inspiring
Originally posted by MacPale View Post
Hold on I downloaded the program again and its working okay now Smile



yep but i dont know about classes and all that..


You will as you start to learn OOP. You'll definitely learn it if you take any computer science courses later on. They'll probably teach you something like Java. IMO, Ruby is the way to teach OOP.

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo