asterix
Cris
asterix
This seems interesting so I can have my own variant of c if I follow the standards
asterix
Cris
asterix
Cris
it was needed because our compiler library was lacking some implementations (about strings), and we wanted instead to write our code with full std::string support.
unfortunately I cannot share it both because I don't have access to this code anymore, and because also if I did, I would not have the rights.
But you can still browse open implementations and take inspiration:
https://github.com/search?q=c+standard+library
Cris
Arusha98
hello everyone can anyone share with me , eclipse setup so that I can use to write and run code
der ðiβüśüɾę
do you know, where g++ source code?
der ðiβüśüɾę
I'm search about hour
der ðiβüśüɾę
Suka
Rahul
Hi
Anonymous
hello. anyone here can help me with my activity. c++ language.
Anonymous
heres the problem. In the text file given a set of string that contains dashes (-) and asterisk (*) also known as bomb. the task is to count how many bombs can be found .
Anonymous
I've been doing this for two days but I can't get the right answer. Please help me.
kartik
Any code which in bat file to capture putty screen on windows after every command save to desktop directory
shuzuya
Damo
Hi
Damo
Can anyone solve nibble swap of a number in one line
Damo
In c
kartik
Hi all looking for c script or else which combines with putty , when run the command it will capture the screen of terminal all output in jpg format any one help request for all devlopers
Arusha98
Ambrose
I'm humbled to be here!
B121065_Swoyam Siddharth Nayak
#include<iostream>
using namespace std;
void swap(int arr[], int a, int b){
int temp=arr[a];
arr[a]=arr[b];
arr[b]=temp;
}
int pivot(int arr[], int f, int l){
int pi=arr[l];
int i=f-1;
for(int j=f;j<l;j++){
if(arr[j]<pi){
i++;
swap(arr, i, j);
}
}
swap(arr, i+1, l);
}
void quicksort(int arr[], int f, int l){
if(f<l){
int mid=pivot(arr, f, l);
quicksort(arr, f, mid-1);
quicksort(arr, mid+1, l);
}
}
int main(){
int n;
cin>>n;
int array[n];
for(int i=0;i<n;i++){
cin>>array[i];
}
quicksort(array, 0, n-1);
for(int i=0;i<n;i++){
cout<<array[i]<<" ";
}
return 0;
}
Whats wrong in this code of quick sort, am not getting any output
Anonymous
#include<iostream>
using namespace std;
void swap(int arr[], int a, int b){
int temp=arr[a];
arr[a]=arr[b];
arr[b]=temp;
}
int pivot(int arr[], int f, int l){
int pi=arr[l];
int i=f-1;
for(int j=f;j<l;j++){
if(arr[j]<pi){
i++;
swap(arr, i, j);
}
}
swap(arr, i+1, l);
}
void quicksort(int arr[], int f, int l){
if(f<l){
int mid=pivot(arr, f, l);
quicksort(arr, f, mid-1);
quicksort(arr, mid+1, l);
}
}
int main(){
int n;
cin>>n;
int array[n];
for(int i=0;i<n;i++){
cin>>array[i];
}
quicksort(array, 0, n-1);
for(int i=0;i<n;i++){
cout<<array[i]<<" ";
}
return 0;
}
Whats wrong in this code of quick sort, am not getting any output
Im not an expert but check the #include part
B121065_Swoyam Siddharth Nayak
like whats incorrect in that
Anonymous
It should be: #include <iostream>
B121065_Swoyam Siddharth Nayak
Anonymous
With a space between the e and the <
Ravi
Ravi
Mistake should be in logic
Ravi
or either in swap function, try passing the referrence instead of the value of array
Ravi
Well I am not sure if it is call by reference or not, bt try call by reference
Anonymous
Hi
Anonymous
Write a program in C++ to find the square of 5 numbers that the user enters in an unary array
Anonymous
I am new here
Anonymous
I finish html😍
Morgan
Hi I'm new here
Aura
Aura
Welcome here though
Morgan
asterix
Butterfly Around Wàist
/get
Butterfly Around Wàist
Sorry
Butterfly Around Wàist
I just click on this
Earl B
So, I am on the very last chapter of "Absolute Beginners Guide to C" and I have copied the code exactly, but for whatever reason my compiler is giving me an error.
expected identifier or '(' before '{' token and will not build.
I'm guessing it's because the book is old and not using c99 standards, but I would be happy if someone could maybe translate the code to c99 or something?
Here's the code.
// Example program #1 from Chapter 32 of Absolute Beginner's Guide
// to C, 3rd Edition
// File Chapter32ex1.c
/* The program demonstrates functions returning a value by passing
three floating-point numbers (grades) and calculating the average of
the three. */
#include <stdio.h>
float gradeAve(float test1, float test2, float test3);
int main ()
{
float grade1, grade2, grade3;
float average;
printf("What was the grade on the first test? ");
scanf(" %f", &grade1);
printf("What was the grade on the second test? ");
scanf(" %f", &grade2);
printf("What was the grade on the third test? ");
scanf(" %f", &grade3);
//Pass the three grades to the function and return the average
average = gradeAve(grade1, grade2, grade3);
printf("\nWith those three test scores, the average is %.2f", average);
return 0;
}
float gradeAve(float test1, float test2, float test3);
// Receives the values of three grades
{
float localAverage;
localAverage = (test1 + test2 + test3)/3;
return (localAverage); // returns average
}
Anonymous
So, I am on the very last chapter of "Absolute Beginners Guide to C" and I have copied the code exactly, but for whatever reason my compiler is giving me an error.
expected identifier or '(' before '{' token and will not build.
I'm guessing it's because the book is old and not using c99 standards, but I would be happy if someone could maybe translate the code to c99 or something?
Here's the code.
// Example program #1 from Chapter 32 of Absolute Beginner's Guide
// to C, 3rd Edition
// File Chapter32ex1.c
/* The program demonstrates functions returning a value by passing
three floating-point numbers (grades) and calculating the average of
the three. */
#include <stdio.h>
float gradeAve(float test1, float test2, float test3);
int main ()
{
float grade1, grade2, grade3;
float average;
printf("What was the grade on the first test? ");
scanf(" %f", &grade1);
printf("What was the grade on the second test? ");
scanf(" %f", &grade2);
printf("What was the grade on the third test? ");
scanf(" %f", &grade3);
//Pass the three grades to the function and return the average
average = gradeAve(grade1, grade2, grade3);
printf("\nWith those three test scores, the average is %.2f", average);
return 0;
}
float gradeAve(float test1, float test2, float test3);
// Receives the values of three grades
{
float localAverage;
localAverage = (test1 + test2 + test3)/3;
return (localAverage); // returns average
}
Does it tell u which line?
Anonymous
float gradeAve(float test1, float test2, float test3); <---- the book has ";" ?
Earl B
Anonymous
#include <stdio.h>
float gradeAve(float test1, float test2, float test3);
Anonymous
and the one without ; are not the same
Anonymous
perhaps you copied and pasted from the first line
Earl B
it's possible. whenever I copy from the book I have to do it line by line because it formats everything incorrectly.
do different programming languages have more descriptive compiler error messages?
Anonymous
nope ... basically the first thing I look for is the immediate line above the error line reported
Anonymous
so once you say line 35 , my eyes went to the line above it
Earl B
good to know, I would imagine it would be really difficult to troubleshoot in a huge program without that trick. I'll definitely be adopting that
HaiNahi
Anyone know android studio how to draw pixels on it
Diego
If you take a screenshot and fire up mspaint you can draw pixels on it
HaiNahi
Lol android app I want to make
HaiNahi
I used SDL to develop apps for desktop now I want for android
Diego
https://skia.org/
Anonymous
#include<iostream>
using namespace std;
void swap(int arr[], int a, int b){
int temp=arr[a];
arr[a]=arr[b];
arr[b]=temp;
}
int pivot(int arr[], int f, int l){
int pi=arr[l];
int i=f-1;
for(int j=f;j<l;j++){
if(arr[j]<pi){
i++;
swap(arr, i, j);
}
}
swap(arr, i+1, l);
}
void quicksort(int arr[], int f, int l){
if(f<l){
int mid=pivot(arr, f, l);
quicksort(arr, f, mid-1);
quicksort(arr, mid+1, l);
}
}
int main(){
int n;
cin>>n;
int array[n];
for(int i=0;i<n;i++){
cin>>array[i];
}
quicksort(array, 0, n-1);
for(int i=0;i<n;i++){
cout<<array[i]<<" ";
}
return 0;
}
Whats wrong in this code of quick sort, am not getting any output
In your pivot function, you forgot "return i+1" at the end.
And instead of choosing the last element as a pivot always, choose a random element.
Anonymous
Thanks fr adding me
B121065_Swoyam Siddharth Nayak
Anonymous
Hi guys c++ has any standard library or macros to generate reports and graphs at run time?
Anonymous
hola