Just starting taking a C++ programming class and am lost. Anyone here do programming?
Announcement
Collapse
No announcement yet.
Anyone here use C++?
Collapse
X
-
Originally posted by Wide-J View PostJust starting taking a C++ programming class and am lost. Anyone here do programming?
Have not touched the stuff in years but i still remember most of it, what do you need help with?
If then statements, do loops, do while loops? conditions, functions"when I'm riding my motorcycle,I'm glad to be alive...when I stop riding my motorcycle,I'm glad to be alive"
-
Here is the code that I have written but I am sure I am way off. Anyone have feedback?
/*---------------------------------------------------------------------------*/
/* Weight Conversion */
/* */
/* This will convert Newtons to Pounds */
#include <iostream> // Required for cout, endl.
#include <cmath> // Required for sqrt()
using namespace std;
int main()
{
// Declare and initialize objects.
double LB(1), N(4.48);
// Compute each pound to newtons.
LB*N;
//Print distance;
;cout << "Converted pounds to Newtons";
endl;
// Exit program.
return 0;
{
/*-------------------------------------------------------------------*/88 YJ...kinda. Clayton Hard Arms, V8, 1 tons w/Detroits, twin sticked T-18/NP205, Irok's, MasterCrafts, fuel cell, multi-colored
Comment
-
you didnt output anything besides "Converted..."
you need to create a variable for the result like
double result;
result = lb*n;
then cout result
also second to last line should be } not { and no ; b4 cout
also you dont need to put ; at the end off your comments " // comment;""when I'm riding my motorcycle,I'm glad to be alive...when I stop riding my motorcycle,I'm glad to be alive"
Comment
-
also its good practice to put the "endl" on the same line of your output
cout << "Hello World!" << endl;
so if you wanted to output your results you can do
cout << "Converted " << LB << " pounds to newtons is: " << result << endl;
</pre>"when I'm riding my motorcycle,I'm glad to be alive...when I stop riding my motorcycle,I'm glad to be alive"
Comment
-
This class is entirely frustrating. It is an online course and we are using a book that is not the beginner book...That's great for anyone that knows anything about programming I suppose. Now I have to create an even more complex file and have no idea how to begin. Especially since the last file I created didnt work.88 YJ...kinda. Clayton Hard Arms, V8, 1 tons w/Detroits, twin sticked T-18/NP205, Irok's, MasterCrafts, fuel cell, multi-colored
Comment
-
I am using Microsoft Visual Stuido 10. Now I need to write a program that sks the user to enter the number or atoms of each of the five elements for an amino acid. Then compute and print the molecular weight for this amino acid.88 YJ...kinda. Clayton Hard Arms, V8, 1 tons w/Detroits, twin sticked T-18/NP205, Irok's, MasterCrafts, fuel cell, multi-colored
Comment
-
coding is all about syntax..... just knowing the right way to set up code, the rest is jsut calculations that you can look up.
also your #includes were no correct on your first program
should be:
#include <iostream>
using namespace std;
and input is easy
double var1;
cout << "Please enter variable 1: " <<endl;<endl;>
cin >> var1;
bang thats it
</endl;></iostream>"when I'm riding my motorcycle,I'm glad to be alive...when I stop riding my motorcycle,I'm glad to be alive"
Comment
-
I think I am going to drop the class. I am completely lost on everything. I really hate that it is an online course. This is the first time they are trying it. For me, it doesnt work at all!88 YJ...kinda. Clayton Hard Arms, V8, 1 tons w/Detroits, twin sticked T-18/NP205, Irok's, MasterCrafts, fuel cell, multi-colored
Comment
Comment