I wonder if C++ is any better than a common BASIC, for example GW
BASIC.
What can you do with C++ that BASIC can't do?
C++ seems so incredibly complicated, even more complicated than
Assembler.Why bother with C++? 4 1948
"Gerry Lintonice" <mi********@yah oo.com.au> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. . I wonder if C++ is any better than a common BASIC, for example GW BASIC.
What can you do with C++ that BASIC can't do?
C++ seems so incredibly complicated, even more complicated than Assembler.Why bother with C++?
Better is subjective, especially in this case when you didn't ask better for
anything in particular.
Languages are tools. If I'm working on an IBM AS/400 and I want to do a
quick report, I'm going to use RPG not C++.
Personally, I would always use C++ instead of any flavor of BASIC if I'm
given the choice, but there may be cases where BASIC is preferred
(especially on some platforms that it may be my only choice).
Gerry Lintonice wrote: I wonder if C++ is any better than a common BASIC, for example GW BASIC.
What can you do with C++ that BASIC can't do?
C++ seems so incredibly complicated, even more complicated than Assembler.Why bother with C++?
Well depends on what you want to do...
Generic and type independent programming for instance:
This is a simple _complete_ program in c++. It can accept 10 values of
ANY type (including user defined types, provided certain conditions are
met) and sort them. Try this in BASIC/Assembler!! And I haven't even
mentioned polymorphism yet :)
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std; // not recommended, only for illustration
typedef int mytype; // substitute 'int' with almost any type
int main()
{
vector<mytype> vec;
cout << "Enter 10 values:\n";
for(int i = 0; i < 10; ++i)
{
mytype num;
cin >> num;
vec.push_back(n um);
}
cout << "The sorted list is :\n";
sort(vec.begin( ), vec.end());
for(int i = 0; i < 10; ++i)
{
cout << vec[i] << '\n';
}
return 0;
}
On 13 Sep 2005 18:22:42 -0700, "Gerry Lintonice" <mi********@yah oo.com.au>
wrote: I wonder if C++ is any better than a common BASIC, for example GW BASIC.
Define "better".
What can you do with C++ that BASIC can't do?
Plenty.
C++ seems so incredibly complicated, even more complicated than Assembler.Wh y bother with C++?
Because each language represents a cost/benefit tradeoff. C++ has proven to be
quite profitable to learn and use so far.
-dr
"hacker++" <at************ *@gmail.com> wrote in message
news:11******** *************@g 49g2000cwa.goog legroups.com... Well depends on what you want to do... Generic and type independent programming for instance: This is a simple _complete_ program in c++. It can accept 10 values of ANY type (including user defined types, provided certain conditions are met) and sort them. Try this in BASIC/Assembler!! And I haven't even mentioned polymorphism yet :)
Just for fun I did the same with D, a little shorter and simpler:
import std.cstream;
import std.stdio;
alias int myint;
void main()
{
writefln("Enter 10 values:");
myint[] vec;
for (int i = 0; i < 10; i++)
{ myint j;
din.readf(&j);
vec ~= j;
}
vec.sort;
writefln("The sorted list is: ", vec);
}
-Walter www.digitalmars.com C, C++, D compilers This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Brandon J. Van Every |
last post by:
What's better about Ruby than Python? I'm sure there's something. What is
it?
This is not a troll. I'm language shopping and I want people's answers. I
don't know beans about Ruby or have any preconceived ideas about it. I have
noticed, however, that every programmer I talk to who's aware of Python is
also talking about Ruby. So it seems that Ruby has the potential to compete
with and displace Python. I'm curious on what basis it...
|
by: Randell D. |
last post by:
Folks,
I once read an article in Linux Format whereby a technical writer had
made performance recommendations on a LAMP environment. One of the
points raised was for small columns in a database, that one is perhaps
better off to trade a small waste of space for a gain on performance -
The recommendation said that when you use VARCHAR(3) that MySQL searches
for disk space to take a record that will accept a variable length
value up to...
|
by: Faith Dorell |
last post by:
I really don´t like C.You can write better programs in BASIC than in
C, if you don´t like this language.
I don´t understand how C became so popular, although much better
programming languages existed in the 70s or 80s or 90s.
Pascal is much better.
|
by: Sai Kit Tong |
last post by:
I posted for help on legacy code interface 2 days ago. Probably I didn't
make it clear in my original mail. I got a couple of answers but none of
them address my issues directly (See attached response). My first reply
directed me to source code migration but I didn't have the source code. The
second reply mentioned about .NET interoperability (PInvoke I think) but I
MENTIONED THAT I COULDN'T FIND ANY DOCUMENTATION FROM MSDN LIBRARY BASED ON...
|
by: Bob |
last post by:
Hi there,
I am working on an application to be used in our local Forensics
department...
Among other things the app will connect to a digital camera and download the
images to the hard drive. For various reasons I need to be able to say with
certainty that the image on the hard drive is exactly what was on the
camera... any ideas on best way to achieve this...?
| |
by: windandwaves |
last post by:
Hi Folk
I have to store up to eight boolean bits of information about an item
in my database.
e.g.
with restaurant
drive-through facility
yellow windows
|
by: Paul |
last post by:
I have a product that contains several components. I want the user to come
to my site and "build a product" out of the available components.
I envision something like this:
- user sees a basic product on the page
- clicks on a component to view options for that component
- can change components, mix and match by clicking on each component and
selecting from the options available to arrive at a final product they want.
- ideally, then...
|
by: Patient Guy |
last post by:
Which is the better approach in working with Javascript?
1. Server side processing: Web server gets form input, runs it into the
Javascript module, and PHP collects the output for document prep.
2. Client side processing: Web server gets form input and passes it to PHP
which includes the Javascript written in a way to make the form input
processed on the client side and rendered (probably using DOM function
calls) on that side as...
|
by: Pawel_Iks |
last post by:
I've read somewhere that c++ is something more than better c ... then
I talk with my friend and he claimed that c++ is nothing more than
better c ... I tried to explain him that he was wrong but I forgot all
arguments about it. Could someone told something about it?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |