473,385 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Is C++ any better than BASIC?

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++?

Sep 14 '05 #1
4 1932
"Gerry Lintonice" <mi********@yahoo.com.au> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.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).
Sep 14 '05 #2
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(num);
}

cout << "The sorted list is :\n";
sort(vec.begin(), vec.end());

for(int i = 0; i < 10; ++i)
{
cout << vec[i] << '\n';
}

return 0;
}

Sep 14 '05 #3
On 13 Sep 2005 18:22:42 -0700, "Gerry Lintonice" <mi********@yahoo.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.Why 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
Sep 14 '05 #4

"hacker++" <at*************@gmail.com> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.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

Sep 14 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

220
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...
8
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,...
24
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...
3
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...
24
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....
39
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
1
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...
84
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....
43
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.